I have these function:
#execute vim and then exit on err return
ve() {
vim "$@" || exit
}
export -f ve
#compile c source -> asm source in new tab in xfce terminal
casm() {
[ -z ${1} ] && return
fname=$1
xfce4-terminal --tab -e "bash -c "\""gcc -S $fname.c; ve $fname.s ;exec bash \""
}
export -f casm
In this case, the ve function ("vim and exit" == "ve"), is called in the second one in double quotes (see here:gcc -S $fname.c; ve $fname.s ;exec bash). The problem is the bash will give err bash: ve: command not found (I have export it afterwards, as you can see), I do not know what else I should do to make it more visible.
For second try, I have tried this:
#compile c source -> asm source in new tab in xfce terminal
casm() {
[ -z ${1} ] && return
fname=$1
xfce4-terminal --tab -e "bash -c "\""gcc -S $fname.c; $(ve $fname.s) ;exec bash \""
}
export -f casm
That is - make the command to be subshell, but then when trying to open it -> Vim: Warning: Output is not to a terminal, which makes it to crash the terminal. So the question is, how to embed a global function in double quotes and make it safe?