File tree Expand file tree Collapse file tree 2 files changed +20
-19
lines changed Expand file tree Collapse file tree 2 files changed +20
-19
lines changed Original file line number Diff line number Diff line change 1
1
@ 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
-
7
- ssh -p 5679 tph6hc@ 127.0.0.1 'tph6hc_test/Shell_Script_Learn/hmi_bash.sh'
8
2
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
9
9
10
+ ssh -p %hostport% %usr% @ 127.0.0.1 " bash hmi_bash.sh"
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- find_result=` find -name hmi_bash.sh`
3
+ find_result=` find ~ / -maxdepth 1 -name hmi_bash.sh`
4
4
if [[ -z $find_result ]]
5
5
then
6
- touch hmi_bash.sh
7
- chmod 755 hmi_bash.sh
6
+ touch ~ /hmi_bash.sh
8
7
fi
9
8
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
12
12
13
- find_demo=` find -name Demo`
13
+ find_demo=` find ~ / -maxdepth 1 -name Demo`
14
14
if [[ -z $find_demo ]]
15
15
then
16
- mkdir Demo
16
+ mkdir ~ / Demo
17
17
fi
18
18
19
- find_hello=` find Demo/ hello.txt`
19
+ find_hello=` find ~ /Demo -maxdepth 1 -name hello.txt`
20
20
if [[ -z $find_demo ]]
21
21
then
22
- touch Demo/hello.txt
22
+ touch ~ / Demo/hello.txt
23
23
fi
24
24
25
- echo " Hello world" > Demo/hello.txt
25
+ echo " Hello world" > ~ / Demo/hello.txt
26
26
if [[ $? == 0 ]]
27
27
then
28
- echo " Written \" Hello world \" into Demo/hello.txt"
28
+ echo " Written \" Hello world \" into Demo/hello.txt"
29
29
fi
30
30
31
- cp . /hmi_bash.sh . /Demo/
31
+ cp ~ /hmi_bash.sh ~ /Demo/
32
32
if [[ $? == 0 ]]
33
33
then
34
- echo End
34
+ echo End
35
35
fi
You can’t perform that action at this time.
0 commit comments