Welcome to the Linux Foundation Forum!

LFS201 LAB 37.3


Can someone tell me what the "set -x" syntax at the beginning of the script on item 6 in this lab means?


set -x

rsync --progress -zvrxH -e "ssh -c blowfish" --delete $*

I looked under the set man page, which explains that it identifies a key sequence that executes a shell command. I'm not really sure what this means or how it is used here.


  • coop
    coop Posts: 915
    It means turn on debugging, which means echoing all commands
    to the console *before* they are executed, essentially it means verbose.
    You turn off this debug mode with set +x. This is all buried somewhere in the man
    page for bash, not set. It is also discussed in the "debugging" section of the
    bash chapter I'm pretty sure, but I don't have the class in front of me.

    so you often do:

    set -x

    ... some commands

    set +x

    when you want to get more detailed output, often but not exclusively, while debugging
    a script.


Upcoming Training