vishex ()
{
echo '#!/bin/bash' > $1;
chmod +x $1;
vi $1
}
The goal of the above function is to have an alias for fast and comfortable creation of bash scripts. I would like that at the opening of the file the cursor would be not standing in the Shebang line but on a line below. I've tried something like echo 'blabla\n', echo "blala\n", printf "blala\n"
without any result.
echo '#!/bin/bash' > $1;
toecho -e '#!/bin/bash\n' > $1;
. Then follow Radovan's answervishex mygreatscript.sh
and lose dozens or hundreds of lines of code. You are tempting Murphy. So start the function with[ -e "$1" ] && return 1
[ -f "$1" ] && exit 1
return
, notexit
(or bye-bye shell). Or do it as chaos did it in his answer.