Quantcast
Channel: Run multiple line as a single line command bash - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2

Run multiple line as a single line command bash

$
0
0

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 ]thenecho Successfulecho $idelseecho failecho $idfi

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


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images