Welcome to WebmasterWorld Guest from 34.225.194.144

Forum Moderators: bakedjake

Message Too Old, No Replies

Shell script troubles

Move ("mv") not working inside shell script

     
1:28 pm on Apr 10, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7256
votes: 3


I'm grabbing a file from server A which builds a graph for me, then I need to move it and rename it to *.png on server B:-


wget -q www.mydomain.org/vertical-bar-graph.php?dbinfo=/home/mydomain/dbinfo.txt&config=/home/mydomain/config.txt

That bit works fine, so I have the file, now I want to move and rename it:-

 
mv "/home/myotherdomain/bin/graphing/vertical-bar-graph.php?dbinfo=%2Fhome%2Fmydomain%2Fdbinfo.txt" "/home/myotherdomain/www/io-total.png"

That mv doesn't work - I get a "File or directory doesn't exist" error. Oddly, if I copy that line out of the shell script and paste it to the command line proper, it works fine.

I wonder if it's something to do with all the %2f etc stuff in the filename?

I have tried it with and without both double and single quotes.

Any ideas?

Thanks,

TJ

2:29 pm on Apr 10, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7256
votes: 3


Fixed it in a way - I discovered the -O switch in wget so I can dump the file anywhere I want to direct.

Still curious as to why the above didn't work though, if anyone knows the answer... ;)

6:47 pm on Apr 10, 2006 (gmt 0)

New User

10+ Year Member

joined:Mar 30, 2006
posts:12
votes: 0


I bet it is coming down to the white spaces..

If you were to replace

/home/myotherdomain/bin/graphing/vertical-bar-graph.php?dbinfo=%2Fhome%2Fmydomain%2Fdbinfo.txt

with

/home/myotherdomain/bin/graphing/*dbinfo.txt "/home/myotherdomain/www/io-total.png"

It will most likely work...

Items such as %2Fhome%2 need to be escaped with \

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members