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?

#!/bin/bash

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.

Comments

  • Posts: 916
    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.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training