Is there any way to run multiple line as a single line command in bash script.
This is my multiple line bash script
id=15;
if [ $id -ge 30 ]
then
echo Successful
echo $id
else
echo fail
echo $id
fi
I want to run this multiple line as a single line so far i have tried this way
id=15;if [ $id -ge 30 ]&&then&&echo Successful&&echo $id&&else&&echo fail&&echo $id&&fi
but when I executed this command in terminal i got this error
bash: syntax error near unexpected token `then'
Any idea how to change multiple line script to a single line command