Terminal non troverà alcun file / directory con il suffisso "~ /." o "~ /"

-1

il mio terminale non è in grado di trovare alcun file o directory se digito il nome del file o della directory che inizia con "~ /." o "~ /".

Ho installato OS El Capitan, XCode 8 è installato, così come XCode Command Lines Tools.

Modifica

Come richiesto, questa è la riga di comando completa che ho messo (ho provato diversi):

   cd ~/.bash_profile_common
   cd ~/usr
   cd ~/local
   cd ~/bin 

E neanche il cercatore sembra trovarli.

Dopo aver digitato

   echo $HOME

Ottengo

   /Users/myname  
    
posta John Mayne 25.07.2016 - 21:53
fonte

2 risposte

4

~ (tilde) si espande al valore della variabile HOME che è impostata dal processo login o al valore impostato in uno dei file di configurazione della tua shell.

Dalle pagine man:

HOME - The home directory of the current user; the default argument for the cd builtin command. The value of this variable is also used when performing tilde expansion.

Tilde Expansion - If a word begins with an unquoted tilde character ('~'), all of the characters preceding the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the tilde are treated as a possible login name. If this login name is the null string, the tilde is replaced with the value of the shell parameter HOME. If HOME is unset, the home directory of the user executing the shell is substituted instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name.

Nel tuo caso (supponendo che tu non abbia cambiato HOME ), usando ~/bin , ~/usr , ~/local li espandi a /Users/myname/bin , /Users/myname/usr , /Users/myname/local .

Se quello che vuoi è nella cartella radice del tuo sistema, non mettere il ~ (lascia solo / in primo piano).

Riferimenti: man page per bash / man bash

    
risposta data 25.07.2016 - 22:06
fonte
-1

Puoi anche trovare una buona spiegazione del layout di directory standard di Unix con man hier al prompt della shell.

    
risposta data 26.07.2016 - 11:20
fonte

Leggi altre domande sui tag