问题
As per this question here, I'm deploying a linux application on some local servers using a shell script that looks like:
#!/bin/sh
export LD_LIBRARY_PATH=./libs:$LD_LIBRARY_PATH
exec ./TheBinary $*
When I run TheBinary without these wrappers (but after having modified LD_LIBRARY_PATH, which I want to do via the script post-deployment), I can preserve spaces in the command line arguments using double quotes ("). But the above script appears to sanitize them away; how can I modify this script to respect spaces in command line arguments that are wrapped in double quotes?
回答1:
#!/bin/bash
export LD_LIBRARY_PATH=./libs:$LD_LIBRARY_PATH
exec ./TheBinary "$@"
I have no real idea whether /bin/sh supports that syntax
来源:https://stackoverflow.com/questions/7731225/how-can-i-preserve-command-line-spaces-in-a-linux-application