linux music tools It is quite possible and was done all the time in the bad
Sam Hartman
hartmans at mit.edu
Wed Jul 29 12:32:09 UTC 2015
>>>>> "Tony" == Tony Baechler <tony at baechler.net> writes:
Tony> OK, how about this? Even taking into account the differences
Tony> in command names (mv instead of rename, cp for copy, etc) how
Tony> do you make something like this work?
@echo off
echo Test DOS batch file
if "%1" == "" goto help
goto end
:help
echo You must enter a command line parameter.
:end
echo You entered %1.
#!/bin/bash
#in bash labels (functions) need to come before use
help() {
echo "You must enter a command line parameter"
}
if [ "$1" = "" ]; then help
else echo "you entered $1"
fi
Note that functions are not quite like goto. The function returns when
it is done. Put exit at the end of your function if you don't want
that.
However, the same thing in a more bashy way:
#!/bin/bash
if [ "$1" = "" ]; then
echo You must enter a command line parameter
else echo You entered $1
fi
More information about the Blinux-list
mailing list