How do i suppress a line feed in a shell script?



  • The echo command is one of the commands used to suppress a line feed in a shell script. Using the -n option to echo.

    ...
    ...
    echo -n "Which fruit will it be today? "
    ...
    ...
    

    The result will be

    Which fruit will it be today? $ 
    

    The shell prompt stay on the same line, this is commonly used when you are going to use the script for interactive input, another article will show this.


Log in to reply
 

© Lightnetics 2024