Skip to main content
Tweeted twitter.com/StackUnix/status/674375599780208640
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k
Source Link
toliveira
  • 347
  • 3
  • 11

Bash script parsing argument with quotes

Please consider this simple script named test:

#!/bin/bash
echo $1

and the following commands and calls:

$ echo "A B"
A B
$ echo ""A B""
A B
$ echo """A B"""
A B
$ echo """A B"""
A B

$ ./test "A B"
A B
$ ./test ""A B""
A
$ ./test """A B"""
A B
$ ./test """"A B""""
A

Could someone please explain why the call of test doens't behave like the command echo or point to the relevant documentation?