issue related to this: Cannot make bash script work from cloud-init
I tried all kinds of variants like this:
function ge() {
if [ "$1" == ""]
then
geany &
else
eval "geany $1 &"
#also tried:
geany $1 &
geany "$1" &
etc
fi
}
I tried with or without eval, with $1 quoted or not etc. In all cases (if it works at all) I get bash: [: some.txt: unary operator expected
What I want is that the editor opens/creates the file in the background, so I can still use the terminal for foreground tasks.
Ultimately, I want a working function that does what I intended above, but with geany replaced by $EDITOR. So on different platforms I can use a different editor.
Why is the syntax in functions different than in scripts?