How to use an environment variable inside a quoted string in Bash

前端 未结 5 1193
温柔的废话
温柔的废话 2020-12-13 03:17

I\'ve tried various forms of the following in a bash script:

#!/bin/bash
svn diff $@ --diff-cmd /usr/bin/diff -x \"-y -w -p -W $COLUMNS\"

B

5条回答
  •  佛祖请我去吃肉
    2020-12-13 04:02

    The following script works for me for multiple values of $COLUMNS. I wonder if you are not setting COLUMNS prior to this call?

    #!/bin/bash
    COLUMNS=30
    svn diff $@ --diff-cmd /usr/bin/diff -x "-y -w -p -W $COLUMNS"
    

    Can you echo $COLUMNS inside your script to see if it set correctly?

提交回复
热议问题