The error that appears is "unexpected EOF," and as I've made further edits, I've not been able to find it. I believe there's another kind of error here, but BASH might not have a more accurate way of describing it, so "unexpected EOF" is the message I'm getting instead.
Here's the script as currently written:
Code:
#!/bin/bash
#historyswitch-
#Changes the state of histexpand to off when on and vice-versa
function on2off(){
echo -e "History expansion is currently ON."
echo -e "You cant use exclamation points in strings."
echo -e "Do you want me to turn it OFF? {y/n}"
read yesno
if [[ $1yesno != "n" ]]; then
set +H
echo -e "History expansion is now OFF.
echo -e "Happy emphasizing."
else
echo -e "No action taken."
fi
}
function off2on(){
echo -e "History expansion is currently OFF."
echo -e "You cant use carats to edit previous commands."
echo -e "Do you want me to turn it ON? {y/n}"
read yesno
if [[ $2yesno != "n" ]]; then
set -H
echo -e "History expansion is now ON."
echo -e "Enjoy the edits."
fi
if [[ $2yesno = "n" ]]; then
echo -e "No action taken."
fi
}
c=$(set -o | grep histexpand)
if [[ $c == *on* ]]; then
on2off
else
off2on
fi
A silly idea, I know. But I often go for weeks without seeing a single manual page or other reference, and these scripts and aliases serve as excellent shortcuts to command & option syntax I know I'll forget. (I know because I already have forgotten often enough.)
Hope someone can help soon.
BZT