Menu

How to post the code with long lines?

Help
Kirkx
2014-10-02
2014-12-19
  • Kirkx

    Kirkx - 2014-10-02

    I can't figure out how to post the code with long lines on these forums. Bracketing the code with four tildes works ok but only if the code is short:

    ~~~~

    your code goes here

    ~~~~

    Example:

    #!/bin/bash
    bold=`tput bold`
    normal=`tput sgr0`
    echo "${bold}**********************"
    echo "Test Script"
    echo "**********************${normal}"
    echo ""
    echo ""
    echo "Test script running ..."
    echo ""
    echo "Test script run completed."
    # Script End
    

    If the code line is longer it gets cut off at the right end:

    #!/bin/bash
    datetime=$(date +"%y%m%d-%H%M")
    /usr/sbin/ocs-sr -q2 -j2 -z1 -i 1024000 -fsck-src-part-y -p true saveparts lite-$datetime sda21 sda22
    

    The last line should be:

    /usr/sbin/ocs-sr -q2 -j2 -z1 -i 1024000 -fsck-src-part-y -p true saveparts lite-$datetime sda21 sda22

    Here is how it looks on Ubuntu forums:

    http://i.imgur.com/hwFVXLS.png

     

    Last edit: Kirkx 2014-10-02
  • Kirkx

    Kirkx - 2014-11-28

    Thanks for suggestions. For now, I have figured out a workaround. Throw away the shebang line:

    datetime=$(date +"%y%m%d-%H%M")
    /usr/sbin/ocs-sr -q2 -j2 -z1 -i 1024000 -fsck-src-part-y -p true saveparts lite-$datetime sda21 sda22
    
     
  • Steven Shiau

    Steven Shiau - 2014-12-19

    Got it. Thanks for sharing that.

    Steven.

     

Log in to post a comment.