Domanda

Given this script

# cat foo.sh
echo $HOME
set -x
mkdir ~

I am getting this result

# ./foo.sh
/home/Steven Penny
++ mkdir ''
mkdir: cannot create directory `': No such file or directory

If I run mkdir "$HOME" I have no problem. I think the issue is the space in the path, but can someone shed some light on this?

È stato utile?

Soluzione 2

The problem was that the /etc/passwd file was missing.

To elaborate, even one this simple will work

Steven Penny::0:0::/home/Steven Penny

Altri suggerimenti

Looking at your debug output

++ mkdir ''

looks like "~" in mkdir ~ is expanding to nothing, thus causing mkdir to fail. As mkdir $HOME works fine it means you have enough space in the disk.

Can you check if echo ~ is displaying your home directory.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top