Reputation: 1037
Good day all, I am trying to write a script in which a command should contain the colon character ':'. Looking at this document, characters can be escaped using this character '^', but they do not mention the colon character.
The command should be:
iwconfig wlan0 key s:AsciiPassword
So in my script I have something like:
iwconfig $interface key s:$password
When I run the first command manually, it obviously does what is expected, but the second one in the script, Nothing!!! Would appreciate any help
Update: I cannot really produce an output because the command does not produce any.
Upvotes: 7
Views: 20511
Reputation: 74
That document you link relates to windows.
In bash ; escape with '\'.
You also likely want to quote your variable expansions
I would imagine you need:
iwconfig "${interface}" key s:"${password}"
You may need to escape the :, though I doubt it. If so it would be:
iwconfig "${interface}" key s\:"${password}"
Upvotes: 5