Article 5RJ5F bash history

bash history

by
aikempshall
from LinuxQuestions.org on (#5RJ5F)
When I enter a multi-line command at the command line in bash like

Code:echo "alex" | while read LINE
do
EDIT_STRING=$(echo alex | grep "${LINE}" )
if [[ ! -z "$EDIT_STRING" ]];then
echo $EDIT_STRING
mktemp aik.XXXXXX
fi
doneit ends up in the history file as

Quote:
echo "alex" | while read LINE; do EDIT_STRING=$(echo alex | grep "${LINE}" ); if [[ ! -z "$EDIT_STRING" ]];then echo $EDIT_STRING; mktemp aik.XXXXXX; fi ; done
It is retrieved from history as

Quote:
echo "alex" | while read LINE; do EDIT_STRING=$(echo alex | grep "${LINE}" ); if [[ ! -z "$EDIT_STRING" ]];then echo $EDIT_STRING; mktemp aik.XXXXXX; fi ; done

Is there a way in bash to replicate the ksh behavior whereby the command would be stored in history exactly as entered i.e. -

Quote:
805 echo "alex" | while read LINE
do
EDIT_STRING=$(echo alex | grep "${LINE}" )
if [[ ! -z "$EDIT_STRING" ]];then
echo $EDIT_STRING
mktemp aik.XXXXXX
fi
done
So that when it's retrieved from history it appears on the command line as exactly as entered initially.

Thanks
Alexlatest?d=yIl2AUoC8zA latest?i=vbb5-E4TXvw:mpBs6geIdZE:F7zBnMy latest?i=vbb5-E4TXvw:mpBs6geIdZE:V_sGLiP latest?d=qj6IDK7rITs latest?i=vbb5-E4TXvw:mpBs6geIdZE:gIN9vFwvbb5-E4TXvw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments