balistic Posted July 29, 2007 Share Posted July 29, 2007 hi i was hoping someone here could help me, i am running a php script on my server and in the script i want to run this $cmd = 'for name in `ls|grep ?`; do mv $name $name.torrent; done'; system($command2); the $name variable isnt a php one which is i think whats stopping my string from working, it works using SSH on the server and system() works for everything else i try to run that doesnt have the $name var needed for this shell command. is there a way to make sure its outputting it the exact way it is to make it work? thanks in advance Quote Link to comment Share on other sites More sharing options...
trq Posted July 29, 2007 Share Posted July 29, 2007 Firstly... I don't think the ? is a valid regex to use with grep. I don't see why you even need grep here, what particular expression are you trying to match? Secondly... according to your example you are trying to run $command2 via system() not $cmd as you defined it. If you want to move all files, use..... $cmd = 'for name in $(ls --color=none); do mv ${name} ${name}.torrent; done'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.