[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the "-e" command line argument is not recognized

From: Andreas Schwab
Subject: Re: the "-e" command line argument is not recognized
Date: Wed, 16 Feb 2022 09:58:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

On Feb 16 2022, Viktor Korsun wrote:

> runme.sh
> #!/bin/bash
> echo $0
> echo $1
> echo $2
> echo $3
> echo $4
> echo $5
> echo $6

Don't use echo to print unknown text.  Use printf instead, which can
handle this correctly.  Also, don't forget to quote properly.

printf "%s\n" "$4"

> command:
> ./runme.sh -q -w -e -r -t -y
> produced output:
> ./get_env.sh
> -q
> -w

$ help echo
echo: echo [-neE] [arg ...]
    Write arguments to the standard output.
    Display the ARGs, separated by a single space character and followed by a
    newline, on the standard output.
      -n        do not append a newline
      -e        enable interpretation of the following backslash escapes
      -E        explicitly suppress interpretation of backslash escapes

Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]