Skip to content
Advertisement

Tag: quoting

Why I get an error when I try to execute a command remotely?

I have a problem about execute command remotely via SSH. I am trying below. It gives an error like: Answer The problem is that you’re using double quotes to delimit the argument to ssh and also the argument to psql inside the command. This is causing your strings to be parsed incorrectly. You’re also missing the ending double quote for

Bash script: too many arguments in [ test ]

I have the bash script below: When I run it: As you can see, when I don’t pass parameters ( $# -eq 0 ) it fails with “too many arguments”. So, I tested it directly in terminal: So, if it works perfectly in terminal why doesn’t it work passing parameters? Thanks, Answer Your entire expression can be simplified to: This

Stripping single and double quotes in a string using bash / standard Linux commands only

I’m looking for something that will translate a string as follows, using only bash / standard Linux commands: Single-quotes surrounding a string should be removed Double-quotes surrounding a string should be removed Unquoted strings should remain the same Strings with unmatched surrounding quotes should remain the same Single-quotes that don’t surround the string should remain Double-quotes that don’t surround the

Advertisement