如何在Linux应用程序中保留命令行空间? [英] How can I preserve command line spaces in a linux application?
问题描述
根据此问题,我正在使用类似于以下内容的shell脚本在一些本地服务器上部署linux应用程序:
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 $*
当我在没有这些包装的情况下运行TheBinary时(但是在修改了LD_LIBRARY_PATH之后,我想通过脚本后部署进行此操作),我可以使用双引号()保留命令行参数中的空格.但是上面的脚本似乎可以清除它们;如何修改此脚本以尊重用双引号引起来的命令行参数中的空格?
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?
推荐答案
#!/bin/bash
export LD_LIBRARY_PATH=./libs:$LD_LIBRARY_PATH
exec ./TheBinary "$@"
我不知道/bin/sh是否支持该语法
I have no real idea whether /bin/sh supports that syntax
这篇关于如何在Linux应用程序中保留命令行空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!