0

when we print the variable data_data_dir , we get:

echo $data_data_dir
sdb sdc sdd sde sdf

but when we print it with the following approach the we get the value not in the same line

echo  "[`date +%d"/"%b"/"%G"-"%T`] $data_data_dir"
[27/Dec/2017-10:58:08] sdb
sdc
sdd
sde
sdf

while we want it as the following ( expected results )

[27/Dec/2017-10:58:08] sdb sdc sdd sde sdf 
0

Just do not quote $data_data_dir

echo  "[`date +%d"/"%b"/"%G"-"%T`]" $data_data_dir
| improve this answer | |
0

I used below method to achieve the same


 l="sdb sdc sdd sde sdf";  y=`date +%d"/"%b"/"%G"-"%T`;  echo [$y] $l

l="sdb sdc sdd sde sdf" used double quotes at beginning and end of line so it will print in same row when it is called

output

[27/Dec/2017-21:50:43] sdb sdc sdd sde sdf

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.