whenever I call VLC I want to add a parameter by default, namely
So what I did is renamed the VLC binary to vlc.2.1.0 and added a shell script 'vlc' instead that calls it.
It just looks like this:
#!/bin/bash vlc.2.1.0 --codec crystalhd $*
The problem however is that this will cause vlc to throw an error when the filename contains spaces!
So next I tried this modification of above script:
#!/bin/bash vlc.2.1.0 --codec crystalhd "$*"
Indeed this works again since the filename will be enclosed in quotes, however now a new problem arises:
If the script itself is called with additional parameters besides the filename, those will also be placed into those quotes, which of course won't work! Eg:
$ vlc --parm x file\ name\ with\ spaces
will obviously call:
vlc.2.1.0 --codec crystalhd "--parm x file name with spaces"
Isn't there a way to just simply pass the string of command-line arguments AS IS directly to the vlc.2.1.0 call without need for quotes or processing being done on its escape sequences or anything?
Any help appreciated.
Last edited by Jindur (2012-03-01 14:19:26)
you should use "$@" instead of "$*" (and not "*$", btw). And don’t forget the quotes.
Is there a reason for a script rather than an alias?
#in bashrc alias vlc='vlc --codec crystalhd'
This is much cleaner, and will not be broken by every update of vlc,
Awesome, thanks guys. Well I'm not that familiar with bash script as you can see. Actually I know about aliases (using some for extended 'ls') but didn't think of it at all here, probably due to lack of routine I guess. ^^'
Please remember to mark the thread as solved :-)