Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to access environment variables without the '$' in bash? [closed]

This may seem pretty trivial but I am a novice in bash scripting and I could not find the answer elsewhere.

I have mplayer installed on ubuntu 13.04 and I am using it to stream internet radio stations. Normally you need to provide the ip as argument for that:

mplayer http://176.31.113.37:8080

I have created an aliases file in root .bash_aliases where I have the following:

export SOMA="http://173.239.76.147:8090"
export FRESH="http://176.31.113.37:8080"

Now I can play the radio using only the station name: mplayer $FRESH. I was wondering is it possible to get rid of the $ sign also to use the command mplayer FRESH for example.

Thanks!

like image 579
skamsie Avatar asked Feb 13 '23 07:02

skamsie


1 Answers

If you are using variables you need the $ to expand it. I would do this with aliases though, not variables. Consider something like this:

alias mpsoma='mplayer http://192.168.1.1:8090'

Then just type mpsoma to run the full command.

like image 67
idfah Avatar answered Feb 16 '23 02:02

idfah