Skip to content

Commit fb8a5b4

Browse files
tph6hctph6hc
tph6hc
authored and
tph6hc
committed
new
1 parent ba46182 commit fb8a5b4

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

batch_ex1.bat

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
@echo off
2-
Rem This is for listing down all the files in the directory
3-
Rem #1 use hashing to encode the password
4-
Rem #2 use config files
5-
Rem #3 use ssh key
6-
Rem ssh -p 5679 [email protected]
7-
ssh -p 5679 tph6hc@127.0.0.1 'tph6hc_test/Shell_Script_Learn/hmi_bash.sh'
82

3+
rem To set up VMs for ssh follow https://inside-docupedia.bosch.com/confluence/display/RCM/SSH+from+h ost+machine+to+VMs+on+VirtualBox
4+
rem Change usr parameter to VM username and change hostport parameter to the host machine's port that you setup for ssh in VM
5+
rem usr= <your VM username>
6+
rem hostport = <the host machine's port that you setup for ssh in virtualBox>
7+
set usr= tph6hc
8+
set hostport= 5679
99

10+
ssh -p %hostport% %usr%@127.0.0.1 "bash hmi_bash.sh"

task1.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
#!/bin/bash
22

3-
find_result=`find -name hmi_bash.sh`
3+
find_result=`find ~/ -maxdepth 1 -name hmi_bash.sh`
44
if [[ -z $find_result ]]
55
then
6-
touch hmi_bash.sh
7-
chmod 755 hmi_bash.sh
6+
touch ~/hmi_bash.sh
87
fi
98

10-
echo -e '#!/bin/sh\necho "hmi_bash.sh have just been executed"' > hmi_bash.sh
11-
chmod 755 hmi_bash.sh
9+
echo -e '#!/bin/sh\necho "hmi_bash.sh have just been executed"' > ~/hmi_bash.sh
10+
#make the hmi_bash.sh to be executable
11+
chmod 755 ~/hmi_bash.sh
1212

13-
find_demo=`find -name Demo`
13+
find_demo=`find ~/ -maxdepth 1 -name Demo`
1414
if [[ -z $find_demo ]]
1515
then
16-
mkdir Demo
16+
mkdir ~/Demo
1717
fi
1818

19-
find_hello=`find Demo/hello.txt`
19+
find_hello=`find ~/Demo -maxdepth 1 -name hello.txt`
2020
if [[ -z $find_demo ]]
2121
then
22-
touch Demo/hello.txt
22+
touch ~/Demo/hello.txt
2323
fi
2424

25-
echo "Hello world" > Demo/hello.txt
25+
echo "Hello world" > ~/Demo/hello.txt
2626
if [[ $? == 0 ]]
2727
then
28-
echo "Written \" Hello world \" into Demo/hello.txt"
28+
echo "Written \" Hello world \" into Demo/hello.txt"
2929
fi
3030

31-
cp ./hmi_bash.sh ./Demo/
31+
cp ~/hmi_bash.sh ~/Demo/
3232
if [[ $? == 0 ]]
3333
then
34-
echo End
34+
echo End
3535
fi

0 commit comments

Comments
 (0)