Results 1 to 3 of 3
Hi All,
am logged into my work machine and am trying to scp some stuff back to my local machine via the openvpn link. Below is what I have,
for ...
- 10-16-2007 #1Just Joined!
- Join Date
- Dec 2005
- Posts
- 10
scp script query
Hi All,
am logged into my work machine and am trying to scp some stuff back to my local machine via the openvpn link. Below is what I have,
for i in $(ls study/japanese/Bleach\ 1-4/ | grep -Ev "(01)") ; do scp study/japanese/Bleach\ 1-4/$i mark@10.0.129.26:/home/mark/study/japanese/
I am using the expression to remove the first episode, as I already have that downloaded. The script just produces a > prompt. What have I missed?
EDIT:
Oops, I forgot the ending done. I do now get the following output [lunar], which is only the first part of the file's name. See the below smaller script's output.
marks@akito:~$ for i in $(ls study/japanese/Bleach\ 1-4/ | grep -Ev "(01)"); do echo $i;done
[Lunar]
Bleach
-
02
[546BBF6E].avi
[Lunar]
Bleach
-
03
[A9A0FE9F].avi
[Lunar]
Bleach
-
04
[F5B9BCF8].avi
marks@akito:~$ for i in $(ls study/japanese/Bleach\ 1-4/ | grep -Ev "(01)"); do echo -n $i;done
[Lunar]Bleach-02[546BBF6E].avi[Lunar]Bleach-03[A9A0FE9F].avi[Lunar]Bleach-04[F5B9BCF8].avimarks@akito:~$
Neither are desired.
- 10-16-2007 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
When dealing with filenames that have spaces in them it is best to enlclose them in double quotes. The double quotes will allow variables ($i) to expand. Try:
VicCode:for i in $(ls "study/japanese/Bleach 1-4/" | grep -Ev "(01)") ; do scp "study/japanese/Bleach 1-4/$i" mark@10.0.129.26:/home/mark/study/japanese/
- 10-16-2007 #3Just Joined!
- Join Date
- Dec 2005
- Posts
- 10
Hi All,
noted about the "" quotes with spaces in the path. It still produces the below output, which is not the desired effect.
for i in $(ls "study/japanese/Bleach 1-4/" | grep -Ev "(01)"); do echo "$i";done[Lunar]
Bleach
-
02
[546BBF6E].avi
[Lunar]
Bleach
-
03
[A9A0FE9F].avi
[Lunar]
Bleach
-
04
[F5B9BCF8].avi
marks@akito:~$
It then says the path study/japanese/Bleach 1-4/[lunar] is not found. Why is it only placing the first part of the returned path into $i?


Reply With Quote