I wanted to declare an environment variable that stocks all the extensions of video files so I can use it when using the shell.
I tried several things but never got it to work: If in my .bash_profile I put:
export VIDEOS={mp4,wmv,avi,flv,mkv,m4u,mpg,mpeg}
it only takes the last element:
[nbarraille@nbarraille ~]echo $VIDEOS
mpeg
If in my .bash_profile I put:
export VIDEOS="{mp4,wmv,avi,flv,mkv,m4u,mpg,mpeg}"
or
export VIDEOS='{mp4,wmv,avi,flv,mkv,m4u,mpg,mpeg}'
Then, when I display it it looks OK, but it doesn't work when I use it in a ls for example:
[nbarraille@nbarraille ~] echo $VIDEOS
{mp4,wmv,avi,flv,mkv,m4u,mpg,mpeg}
[nbarraille@nbarraille ~] ll *.$VIDEOS
ls: cannot access *.{mp4,wmv,avi,flv,mkv,m4u,mpg,mpeg}: No such file or directory
And when I run the exact same command without using the variable, it works:
[nbarraille@nbarraille ~] echo *.{mp4,wmv,avi,flv,mkv,m4u,mpg,mpeg}
example.avi
example2.mpg
Also, when I reboot, it looks like my .bash_profile is not loading, and the $VIDEOS variable is empty. I have to do a source ~/.bash_profile in order to get it to work (and I have to redo so every time I open a new terminal.
Any idea?
Thanks!