Мой .bashrc
файл является символьной ссылкой на ~/Scripts/rc/bashrc
. Это работает хорошо на меня и было в течение многих лет.
Однако с сегодняшнего дня это - то, что я вижу:
bash-4.3$ source .bashrc
bash: source: .bashrc: file not found
bash-4.3$ ls -la .bashrc
lrwxrwxrwx 1 jonas jonas 17 Oct 28 12:31 .bashrc -> Scripts/rc/bashrc
bash-4.3$ source Scripts/rc/bashrc
jonas@jonas-xps:~$
Я не могу действительно понять это. Почему это внезапно прекратило бы работать? Я использую Utopic на ноутбуке amd64 Dell.
Некоторая отладка ouput:
bash-4.3$ stat .bashrc
File: ‘.bashrc’ -> ‘Scripts/rc/bashrc’
Size: 17 Blocks: 8 IO Block: 4096 symbolic link
Device: 22h/34d Inode: 10880136 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 1001/ jonas) Gid: ( 1001/ jonas)
Access: 2014-10-28 12:31:57.076868217 +0100
Modify: 2014-10-28 12:31:57.076868217 +0100
Change: 2014-10-28 12:31:57.076868217 +0100
Birth: -
bash-4.3$ stat Scripts/rc/bashrc
File: ‘Scripts/rc/bashrc’
Size: 4019 Blocks: 24 IO Block: 4096 regular file
Device: 22h/34d Inode: 11146383 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1001/ jonas) Gid: ( 1001/ jonas)
Access: 2014-10-28 12:29:53.352871873 +0100
Modify: 2014-05-27 12:43:09.470849817 +0200
Change: 2014-05-27 12:43:09.470849817 +0200
Birth: -
bash-4.3$ readlink -e .bashrc
/home/jonas/Scripts/rc/bashrc
Если имя файла не содержит /
, встроенная команда source
может искать имя в PATH
только, в зависимости от некоторых опций оболочки. Таким образом вместо source .bashrc
,
`source ./.bashrc`
должен сделать то, что Вы хотите.
От man bash
:
. filename [arguments]
source filename [arguments]
Read and execute commands from filename in the current shell
environment and return the exit status of the last command exe‐
cuted from filename. If filename does not contain a slash,
filenames in PATH are used to find the directory containing
filename. The file searched for in PATH need not be exe‐
cutable. When bash is not in posix mode, the current directory
is searched if no file is found in PATH. If the sourcepath
option to the shopt builtin command is turned off, the PATH is
not searched.