johnnyv Posted February 25, 2004 Report Share Posted February 25, 2004 (edited) when running scripts i know that if there is a space in a file you escape it with a \ so "blah blah" becomes "blah\ blah". How do you escape characters like &, (, and )? Edited February 25, 2004 by johnnyv Quote Link to comment Share on other sites More sharing options...
fuzzylizard Posted February 26, 2004 Report Share Posted February 26, 2004 Same way. Using \ Quote Link to comment Share on other sites More sharing options...
johnnyv Posted February 26, 2004 Author Report Share Posted February 26, 2004 Oh Ah well, i was just confused because when you do a "dir" you see the \ before spaces but not before & or ( or ) so i though it would be something different. Cheers Quote Link to comment Share on other sites More sharing options...
aru Posted February 26, 2004 Report Share Posted February 26, 2004 (edited) also you can scape such characters by quoting them: with double quotes you scape everything except $ and \ if it's followed by $ and with sigle quotes you scape all for example: ~$ echo this is my path: $PATH; OK? this is my path: /bin:/home/aru/bin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin bash: OK?: command not found ~$ echo "this is my path: $PATH; OK?" this is my path: /bin:/home/aru/bin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin; OK? ~$ echo "this is my path: \$PATH; OK?" this is my path: $PATH; OK? ~$ echo 'this is my path: $PATH; OK?' this is my path: $PATH; OK? ~$ Edited February 26, 2004 by aru Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 26, 2004 Report Share Posted February 26, 2004 @aru: write a book. Quote Link to comment Share on other sites More sharing options...
aru Posted February 26, 2004 Report Share Posted February 26, 2004 but in spanish, my english goes worst every day Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 26, 2004 Report Share Posted February 26, 2004 (edited) but in spanish, my english goes worst every day obviously (obviamente?):P Edited February 26, 2004 by Steve Scrimpshire Quote Link to comment Share on other sites More sharing options...
johnnyv Posted February 26, 2004 Author Report Share Posted February 26, 2004 (edited) Thanks for the tips aru! I am calling the shell commands via php's system_exec() function. Mainly "antiword -t $filepath", "pdftotext $filepath -", and "cat $filepath" It's for a search engine spider i have hacked together, and lucky for me thats all the non php stuff i have to deal with ;) Edited February 26, 2004 by johnnyv 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.
Note: Your post will require moderator approval before it will be visible.