Escape @ from python line command
Question
I don't know if this is a problem with python or with the shell (zsh on linux), I've an argument like this: "@xyz" that starts with a "@"
python the_script.py first_argument @second_argument third_arg
I tried to escape @ with \ or \\, or use "" but the program doesn't start. If I leave the @ from @second_arguments everything's ok.
Solution
Perhaps the "@" is a glob character in zsh, expanding to all symbolic links in the current directory. Try escaping it with "@@"?
Try running the argument list with
echo
, i.e:echo the_script.py first_argument @second_argument third_arg
That way, you can figure out if it was expanded or passed as-is to the script.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow