Skip to main content
add safety quotes
Source Link
ctrl-alt-delor
  • 28.8k
  • 11
  • 67
  • 114

Try:

#!/bin/bash
PATH=$PATHPATH="$PATH:$(dirname $0)"
ls $PATH

This way you're adding $(dirname $0) to the PATH variable instead of replacing it. Or, if you don't want to edit the environment variable and want to use $(dirname $0) separately, use a different variable name.

Try:

#!/bin/bash
PATH=$PATH:$(dirname $0)
ls $PATH

This way you're adding $(dirname $0) to the PATH variable instead of replacing it. Or, if you don't want to edit the environment variable and want to use $(dirname $0) separately, use a different variable name.

Try:

#!/bin/bash
PATH="$PATH:$(dirname $0)"
ls $PATH

This way you're adding $(dirname $0) to the PATH variable instead of replacing it. Or, if you don't want to edit the environment variable and want to use $(dirname $0) separately, use a different variable name.

Source Link

Try:

#!/bin/bash
PATH=$PATH:$(dirname $0)
ls $PATH

This way you're adding $(dirname $0) to the PATH variable instead of replacing it. Or, if you don't want to edit the environment variable and want to use $(dirname $0) separately, use a different variable name.