You are not logged in.
Pages: 1
I am trying to use a variable in a shell script like this....
callsign = N1ZK
wget 'http://aprs.fi/?call='.$callsign.'&c=map'
But this doesn't seem to be working. Can anyone help me? I am sure it is something simple...
Offline
You probably want this
callsign=N1ZK
wget http://aprs.fi/?call=${callsign}\&c=map
You needed to remove the spaces in the variable assignment. You could continue using quotes around the url but you do not need the "." to join the strings.
Offline
You probably want this
callsign=N1ZK wget http://aprs.fi/?call=${callsign}\&c=map
You needed to remove the spaces in the variable assignment. You could continue using quotes around the url but you do not need the "." to join the strings.
No -- remove the quotes -- look at the example -- single quotes as the OP had it doesn't allow for variable interpolation.
-- Thomas Adam
Offline
No -- remove the quotes -- look at the example -- single quotes as the OP had it doesn't allow for variable interpolation.
Could you try again in english please?
There is nothing wrong with what Allan said.
Though he suggested keeping using quotes around the url, and I would recommend that as well :
callsign=N1ZK
wget "http://aprs.fi/?call=${callsign}\&c=map"
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
ThomasAdam wrote:No -- remove the quotes -- look at the example -- single quotes as the OP had it doesn't allow for variable interpolation.
Could you try again in english please?
There is nothing wrong with what Allan said.
Oh sure. It's just that in the original example, we see:
wget 'http://aprs.fi/?call='.$callsign.'&c=map'
SInce it was never pointed out to change the quotes to double quotes, just using single ones wouldn't help here to interpolate "$callsign".
I hope that's English enough for you.
-- Thomas Adam
Offline
SInce it was never pointed out to change the quotes to double quotes, just using single ones wouldn't help here to interpolate "$callsign".
Yeah, but this does work...
wget 'http://aprs.fi/?call='${callsign}'&c=map'
So as I said, he can keep the quotes but remove the "." separating everything. Ugly but it works...
Offline
ThomasAdam wrote:SInce it was never pointed out to change the quotes to double quotes, just using single ones wouldn't help here to interpolate "$callsign".
Yeah, but this does work...
wget 'http://aprs.fi/?call='${callsign}'&c=map'
So as I said, he can keep the quotes but remove the "." separating everything. Ugly but it works...
Oh *right* -- I must be blind.
Yes, ugly. Why not wrap the whole thing in double quotes? The single quotes don't serve a purpose in this instance.
My mistake.
-- Thomas Adam
Offline
Pages: 1