Bash: space in access path

I tried to access a specific path using a bash script, but my terminal won't access it. Here is my very simple script:

#!/bin/bash
init()
{
    cd $PATH
    ls -l
}
PATH="/Volumes/Macintosh HD/Users"
init

      

I tried to write "/ Macintosh \ HD" without success.

+3


source to share


1 answer


Try

cd "$PATH"

      



mark the quotes.

+3


source







All Articles