'How to parse input string in Bash for an SSH command?
When I run the ssh command with a variable declared in bash, it works ok. i.e. a="01-30-22-23-54"
When I pass in the string (representing the date) on the command line, I get the error message: bash: "01-30-22-23-54": command not found
How do I get SSH to consider this variable a string?
I've tried passing into the ssh command: $a, "$a", "{$a}"... im lost
Command Line Input: file.sh -a "01-30-22-23-54"
Parsing input:
while getopts ":a:" arg; do
case $arg in
a) a="$OPTARG";;
esac
done
SSH Command:
ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i ... '/bin/bash -s $a' << 'EOF' "$a"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
