Monday, February 1, 2016

how to split linux command into multiple lines:

ls -l \
   --reverse \
   --human-readable \
   --full-time
       
Using the backslash in this way allows us to embed newlines in our command. Note that for this trick to work, the newline must be typed immediately after the backslash. If you put a space after the backslash, the space will be ignored, not the newline. 


(copied from http://linuxcommand.org/wss0060.php)

Troubleshoot:
avoid whitespaces disturbing the backslash, as mentioned here:
http://stackoverflow.com/questions/18599711/how-can-i-split-a-bash-command-over-multiple-lines-when-using-an-if-statement

No comments:

Post a Comment