0

have a case where i have to source a file in a directory As per man page for source command in bash script it will take path from PATH env variable. i am getting no such file or directory when sourcing file even when file are existing in same directory.

Please can anyone suggest what could be reason. PATH env contains script mounted with ipv6 address.

Thanks in advance

Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29
  • 1
    What do you mean by "PATH env contains script mounted with ipv6 address"? The two concepts aren't really related; the file system should hide any details about whether the files are stored locally or on (for example) a network drive, and even then, the shell doesn't know or care about the underlying network protocol being used. – chepner Aug 30 '16 at 15:31
  • Perhaps the `sourcepath` `shopt` is turned off in your version of `bash`, which prevents `source` from searching through `PATH`? – twalberg Aug 30 '16 at 18:46
  • My source file is present in below path /opt/isvr/mnt/2a00:8a00:a000:1006::a3f:1fed/opt/isvr/repo/appcfg//17-0.11/bin/api "but when i try to run install.sh which inturn calls source util.sh inside same api directory" this returns me no such file or directory. I hope now problem is clear – shilpa shree Aug 31 '16 at 02:28
  • Following is output of my PATH variable /opt/isvr/mnt/2a00:8a00:a000:1006::a3f:1fed/opt/isvr/repo/appcfg//170.11/bin:/opt/isvr/mnt/2a00:8a00:a000:1006::a3f:1fed/opt/isvr/repo/appcfg//17-0.11/bin/api:/opt/isvr/bin:/opt/isvr/bin/api:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin – shilpa shree Aug 31 '16 at 02:36
  • when i read about source command got to know that it takes location to search file form PATH env variable hence the question came whether as my PATH is containing mount path with ipv6 address any format problem exists ?? – shilpa shree Aug 31 '16 at 02:38

1 Answers1

0

I believe the problem is in the colon characters (:) - they are used as a delimiter in PATH to separate each directory.

I tried to set it up myself and escape the colons using backslashes but that does not work either.

So it seems like you simply cannot use directories with semicolons in PATH (maybe there is some nasty trick, but I would not mess with it if I were you)

A possible workaround is to create a symlink for your directory and use the symlink name in PATH instead.

Jiri Valenta
  • 500
  • 2
  • 8