Results 1 to 5 of 5

Thread: Patch to fix formatting in bash shells

  1. #1
    Join Date
    Apr 2008
    Location
    York, UK
    Posts
    134

    Default Patch to fix formatting in bash shells

    This removes the "\n" that get displayed when running pts in a bash shell. It has no effect on the display in a dash shell.

    Code:
    diff --git a/phoronix-test-suite b/phoronix-test-suite
    index ac3808d..f90f053 100755
    --- a/phoronix-test-suite
    +++ b/phoronix-test-suite
    @@ -46,10 +46,16 @@ fi
     # Make sure PHP is installed
     if [ "X$PHP_BIN" = "X" ]
     then
    -       echo "\n\nPHP5 CLI Must Be Installed To Run The Phoronix Test Suite!"
    -       echo "Only PHP For The Command Line Is Needed, Not A Full-Blown PHP w/ Web Server"
    -       echo "The PHP CLI package is usually called php-cli or php5-cli. Also required is the PHP GD library (php-gd)"
    -       echo "For support visit: http://www.phoronix.com/forums/forumdisplay.php?f=49\n\n"
    +       cat <<'EOT'
    +
    +
    +PHP5 CLI Must Be Installed To Run The Phoronix Test Suite!
    +Only PHP For The Command Line Is Needed, Not A Full-Blown PHP w/ Web Server
    +The PHP CLI package is usually called php-cli or php5-cli. Also required is the PHP GD library (php-gd)
    +For support visit: http://www.phoronix.com/forums/forumdisplay.php?f=49
    +
    +
    +EOT
            exit
     fi
    
    @@ -138,31 +144,35 @@ case "$1" in
            $PHP_BIN pts-core/pts-run-cmd.php REFRESH_GRAPHS $2
            ;;
     *)
    -       echo "\n================================="
    -       echo "Phoronix Test Suite"
    -       echo "http://www.phoronix-test-suite.com/"
    -       echo "=================================\n"
    -       echo "install <suite OR test>: Install or Update The Specified Test(s)"
    -       echo "install-dependencies <suite OR test>: Install The External (Distribution) Dependencies For Specified Test(s)"
    -       echo "run <suite OR test>: Run The Specified Test/Suite"
    -       echo "batch-run <suite OR test>: Run The Specified Test/Suite in Batch Mode"
    -       echo "benchmark <suite OR test OR saved file>: Same as manually running install and then run"
    -       echo "batch-benchmark <suite OR test OR saved file>: Same as manually running install and then run in Batch Mode"
    -       echo "batch-setup: Setup the batch mode options"
    -       echo "merge-results <Saved File 1 OR Global ID> <Saved File 2 OR Global ID> <Save To>: Merge two saved result sets"
    -       echo "list-tests: List all Phoronix Test Suite test profiles"
    -       echo "list-suites: List all Phoronix Test Suites"
    -       echo "list-results: List all saved results"
    -       echo "make-download-cache: Backup all saved files to ~/.phoronix-test-suite/download-cache/"
    -       echo "remove-result <Saved File>: Remove this saved result file and associated files"
    -       echo "remove-all-results: Removes all saved results and associated files"
    -       echo "info <suite OR test>: Show detailed information about a test or suite"
    -       echo "system-info: Dump detected software and hardware information detected by PTS"
    -       echo "sensor-options: Show system sensors that can be monitored through PTS"
    -       echo "upload <Saved File>: Upload these results to be shared globally"
    -       echo "show-result <Saved File>: Show this result file in your web browser"
    -       echo "version: Report the Phoronix Test Suite version and code-name"
    -       echo "login: Enter in your PTS Global log-in information for uploading results"
    -       echo "\n"
    +       cat <<'EOT'
    +
    +=================================
    +Phoronix Test Suite
    +http://www.phoronix-test-suite.com/
    +=================================
    +
    +install <suite OR test>: Install or Update The Specified Test(s)
    +install-dependencies <suite OR test>: Install The External (Distribution) Dependencies For Specified Test(s)
    +run <suite OR test>: Run The Specified Test/Suite
    +batch-run <suite OR test>: Run The Specified Test/Suite in Batch Mode
    +benchmark <suite OR test OR saved file>: Same as manually running install and then run
    +batch-benchmark <suite OR test OR saved file>: Same as manually running install and then run in Batch Mode
    +batch-setup: Setup the batch mode options
    +merge-results <Saved File 1 OR Global ID> <Saved File 2 OR Global ID> <Save To>: Merge two saved result sets
    +list-tests: List all Phoronix Test Suite test profiles
    +list-suites: List all Phoronix Test Suites
    +list-results: List all saved results
    +make-download-cache: Backup all saved files to ~/.phoronix-test-suite/download-cache/
    +remove-result <Saved File>: Remove this saved result file and associated files
    +remove-all-results: Removes all saved results and associated files
    +info <suite OR test>: Show detailed information about a test or suite
    +system-info: Dump detected software and hardware information detected by PTS
    +sensor-options: Show system sensors that can be monitored through PTS
    +upload <Saved File>: Upload these results to be shared globally
    +show-result <Saved File>: Show this result file in your web browser
    +version: Report the Phoronix Test Suite version and code-name
    +login: Enter in your PTS Global log-in information for uploading results
    +
    +EOT
            ;;
     esac
    Last edited by uncle_fungus; 05-20-2008 at 10:16 AM.

  2. #2
    Join Date
    Aug 2007
    Posts
    6,634

    Default

    usually you could use

    cat <<'EOT'
    writ your text
    as long as you want
    with any " you want to use
    EOT

    as every line with echo looks a bit useless to me. echo "" is extra useless, but if you like

  3. #3
    Join Date
    Apr 2008
    Location
    York, UK
    Posts
    134

    Default

    Agreed, that is a better way of doing it, and gets rid of the redundant echo ""'s Thanks

    Edited above.

  4. #4
    Join Date
    Aug 2007
    Posts
    6,634

    Default

    This code example is also much better than using echo for the test scripts - you do not need to escape every $ you want to use which leads to errors and makes the script useless without echo. I guess you find my changes to a few install.sh scripts, best example is the nexuiz one with one check for preinstalled Debian nexuiz. This has the old code directly below.

  5. #5

    Default

    Found in master.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •