Skip to main content
added 145 characters in body
Source Link
glenn jackman
  • 88.6k
  • 16
  • 124
  • 179

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ echoprintf '%s\n' $#
1  
1

$ printf '%s\n' "$#"
101

or $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ echo $status=$?
1
$ printf '%s\n' $status
1
1

$ printf '%s\n' "$status"
101

These are contrived examples, but the potential does exist.

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ echo $#
1 1

or $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ echo $?
1 1

These are contrived examples, but the potential does exist.

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ printf '%s\n' $#
1 
1

$ printf '%s\n' "$#"
101

or $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ status=$?

$ printf '%s\n' $status
1
1

$ printf '%s\n' "$status"
101

These are contrived examples, but the potential does exist.

added 2 characters in body
Source Link
GAD3R
  • 69.9k
  • 32
  • 147
  • 216

I was skeptical of Stéphane’s answer, however it is possible to abuse $#$#:

$ set `seq 101`

$ IFS=0

$ echo $#
1 1

or $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ echo $?
1 1

These are contrived examples, but the potential does exist.

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ echo $#
1 1

or $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ echo $?
1 1

These are contrived examples, but the potential does exist.

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ echo $#
1 1

or $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ echo $?
1 1

These are contrived examples, but the potential does exist.

added 57 characters in body
Source Link
Zombo
  • 1
  • 7
  • 47
  • 65

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ [echo $# = 0 ]
bash: [: too many1 arguments1

This is aor $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ echo $?
1 1

These are contrived exampleexamples, but the potential does exist.

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ [ $# = 0 ]
bash: [: too many arguments

This is a contrived example, but the potential does exist.

I was skeptical of Stéphane’s answer, however it is possible to abuse $#:

$ set `seq 101`

$ IFS=0

$ echo $#
1 1

or $?:

$ IFS=0

$ awk 'BEGIN {exit 101}'

$ echo $?
1 1

These are contrived examples, but the potential does exist.

Source Link
Zombo
  • 1
  • 7
  • 47
  • 65
Loading