0

A command like this:

php ~/xxxxxxx/csv/csv_to_datafy_project.php csv_file="/xxxxxx/Dentists~558564~26761~(Emails, Phone, Website) ~ United States.csv.category=Dental Equipment & Supplies.csv"

Which would result in some error like this:

File not exists: /home/n3a6/DATAFY/1/Dentists~558564~26761~(Emails, Phone, Website) ~ United States.csv.category=Dental Equipment

It seems the ampersand cuts the supplied parameter in half. Why?

Thus far I tried \& and && but nothing helped.

How can I escape it in such a situation?

datasn.io
  • 12,564
  • 28
  • 113
  • 154
  • 1
    It's correct from the bash point of view. It's probably a bug in the PHP script. Do you control it or are you trying to work around this bug? – that other guy Mar 08 '20 at 02:09
  • 2
    try `csv_file=%2Fxxxxxx%2FDentists~558564~26761~%28Emails%2C%20Phone%2C%20Website%29%20~%20United%20States.csv&category=Dental%20Equipment%20%26%20Supplies.csv` – Léa Gris Mar 08 '20 at 02:43
  • 2
    Did you copy-and-paste the exact error message? Neither the shell nor `php` would use the phrase "File not exists" (it's incorrect English grammar), though your script `csv_to_datafy_project.php` might. – Keith Thompson Mar 08 '20 at 03:19
  • @LéaGris you are right. Please write an answer and I'll accept it. It's related to my PHP code rather than Bash. – datasn.io Mar 08 '20 at 03:43

0 Answers0