Writing my first bash function, trying to execute it from shell, the contents of the file look like this:
#!/bin/bash
myFirstFunction(){
curl --url "$1" --output "$2" #;
ffmpeg --i "$2" -c:v "$3"; #$2 becomes the input and $3 becomes the new output.
rm "$2" #then I clean up by deleting $2.
}
#end
I give the script permission to run without my typing bash
:
chmod +x myfirstscript.sh
And from shell I tried to fun the function like this:
myfirstscript.sh myFirstFunction inputFN firstOutputFN lastOutputFN
My question:
As far as manuals and tutorials, I cannot find out how to call the function out of the file and pass all the arguments to the function. Can you please show me how?
Carriage Returns Update:
I had been getting this error: myfirstfunction.sh: line 2: syntax error near unexpected token
$'{\r''`. I fixed this by replacing \r\n with \n via notepad++.
Any guidance would be greatly appreciated.