Re: Problem with bash: alias command

2015-12-20 Thread Robert Nichols
On 12/20/2015 10:30 AM, Jon LaBadie wrote: On Sun, Dec 20, 2015 at 01:42:30PM +0100, Joachim Backes wrote: 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

Re: Problem with bash: alias command

2015-12-20 Thread Jon LaBadie
On Sun, Dec 20, 2015 at 01:42:30PM +0100, Joachim Backes wrote: > 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 th

Re: Problem with bash: alias command

2015-12-20 Thread Michael Welle
Hello, Patrick O'Callaghan writes: > On Sun, 2015-12-20 at 15:00 +0100, Joachim Backes wrote: >> Remark: Working with aliases seems to be a bit sophisticated :-) > > Not really. IIRC aliases predate functions. They were first introduced > in the C Shell (see https://en.wikipedia.org/wiki/Alias_(

Re: Problem with bash: alias command

2015-12-20 Thread Patrick O'Callaghan
On Sun, 2015-12-20 at 15:00 +0100, Joachim Backes wrote: > Remark: Working with aliases seems to be a bit sophisticated :-) Not really. IIRC aliases predate functions. They were first introduced in the C Shell (see https://en.wikipedia.org/wiki/Alias_(command)) and are thus more limited. poc --

Re: Problem with bash: alias command

2015-12-20 Thread Joachim Backes
On 20.12.2015 13:42, Joachim Backes wrote: 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"? All comments are welcome. Kind regards

Re: Problem with bash: alias command

2015-12-20 Thread Michael Welle
Hello, Michael Welle writes: > Hello, > > Philip Brown writes: > >> same problem... not on my terminal >> >> bash-4.3$ x 1 >> PAR=1 >> >> but I must say you explained "the why" very well regards the initial >> empty parameter > by problem I mean the expectation that $1 has any meaning in this >

Re: Problem with bash: alias command

2015-12-20 Thread Michael Welle
Hello, Philip Brown writes: > same problem... not on my terminal > > bash-4.3$ x 1 > PAR=1 > > but I must say you explained "the why" very well regards the initial > empty parameter by problem I mean the expectation that $1 has any meaning in this context. It looks like it will work, but it will

Re: Problem with bash: alias command

2015-12-20 Thread Philip Brown
same problem... not on my terminal bash-4.3$ x 1 PAR=1 but I must say you explained "the why" very well regards the initial empty parameter On Sun, Dec 20, 2015 at 2:20 PM, Michael Welle wrote: > Hello, > > Philip Brown writes: > > > i think that is a feature of echo > > if you want without

Re: Problem with bash: alias command

2015-12-20 Thread Michael Welle
Hello, Philip Brown writes: > i think that is a feature of echo > if you want without the space you could use printf > > alias x='printf "PAR=%s\n" $1' same problem as with the initial question. What value does the $1 have? It is empty. alias does not expect any parameters, if that might be the

Re: Problem with bash: alias command

2015-12-20 Thread Philip Brown
i think that is a feature of echo if you want without the space you could use printf alias x='printf "PAR=%s\n" $1' On Sun, Dec 20, 2015 at 1:42 PM, Joachim Backes < joachim.bac...@rhrk.uni-kl.de> wrote: > Hi all, > > Running F23, and my shell is /bin/bash. > > My problem: suppose you define an

Re: Problem with bash: alias command

2015-12-20 Thread Michael Welle
Hello, Joachim Backes 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 formu

Re: Problem with bash: alias command

2015-12-20 Thread Fulko Hew
On Sun, Dec 20, 2015 at 7:57 AM, Fulko Hew wrote: > On Sun, Dec 20, 2015 at 7:42 AM, Joachim Backes > wrote: >> 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

Re: Problem with bash: alias command

2015-12-20 Thread Fulko Hew
On Sun, Dec 20, 2015 at 7:42 AM, Joachim Backes wrote: > 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"? > > All

Problem with bash: alias command

2015-12-20 Thread Joachim Backes
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"? All comments are welcome. Kind regards Joachim Backes -- Fedora release 23 (Twenty