Problem with bash: alias command

Michael Welle mwe012008 at gmx.net
Sun Dec 20 13:05:08 UTC 2015


Hello,

Joachim Backes <joachim.backes at rhrk.uni-kl.de> writes:

> Hi all,
>
> Running F23, and my shell is /bin/bash.
>
> My problem: suppose you define an alias:
>
> alias x='echo PAR=$1'
>
> Now call the alias by:
>
> x 1
>
> Output: PAR= 1
>
> My question: why do I get the blank before the "1"?
because you wrote it when formulating the command line. $1 is empty in
your environment, so x is expanded to 'echo PAR='. The rest of your
command, which is ' 1', is appended then, resulting in 'echo PAR= 1'.

Regards
hmw


More information about the users mailing list