Bash Continue Command / Script On The Next Line

How do I tell bash to continue the command on the next line when commands are so large and can not fit on a single line under Unix like operating systems?

You need to use the character i.e a backslash. From the bash man page:

A non-quoted backslash ‘’ is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline. If a newline pair appears, and the backslash itself is not quoted, the newline is treated as a line continuation (that is, it is removed from the input stream and effectively ignored).

commannd1 arg1 arg2
arg3 arg4


commannd1 -arg1 -arg2
-arg3 -arg4
-arg5 -arg6


The following command is used to compile and install nginx web server. A backslash () is used as to continue command on the next line:

./configure --without-http_autoindex_module --without-http_ssi_module 
           --without-http_userid_module --without-http_auth_basic_module 
           --without-http_geo_module --without-http_fastcgi_module 
           --without-http_empty_gif_module  --with-openssl=/lib64

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts