ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] script on bash
@ 2005-04-26 13:26 Andrey Rybak
  2005-04-26 13:41 ` Шайхутдинов Дамир
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Rybak @ 2005-04-26 13:26 UTC (permalink / raw)
  To: community

Hi, Alt-ы!
Ситуация такая:

$ls -al myScript.sh
-rwxr-xr-x  1 andrey andrey 728 Апр 26 16:13 myScript.sh

$ echo $SHELL
/bin/bash

Так вот сама проблема:
строчка
PATH="/opt/intel_fc_80/bin:$PATH"; export PATH
из командной строки срабатывает (модифицирует $PATH), а в скрипте (а он 
из одной этой строки и состоит)- нет.
Не смертельно - но очень интересно: чего это он может не работать?

#!/bin/bash
PATH="/opt/intel_fc_80/bin:$PATH"; export PATH



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] script on bash
  2005-04-26 13:26 [Comm] script on bash Andrey Rybak
@ 2005-04-26 13:41 ` Шайхутдинов Дамир
  2005-04-26 14:17   ` Andrey Rybak
  0 siblings, 1 reply; 3+ messages in thread
From: Шайхутдинов Дамир @ 2005-04-26 13:41 UTC (permalink / raw)
  To: community

> Так вот сама проблема:
> строчка
> PATH="/opt/intel_fc_80/bin:$PATH"; export PATH
> из командной строки срабатывает (модифицирует $PATH), а в скрипте (а он  
> из одной этой строки и состоит)- нет.
> Не смертельно - но очень интересно: чего это он может не работать?
>
> #!/bin/bash
> PATH="/opt/intel_fc_80/bin:$PATH"; export PATH

Попробуй запускать скрипт не через
  ./myScript.sh,
а через
  source myScript.sh

Потому что скрипт меняет только свои переменные окружения, но не  
переменные окружения родительского шелла. Соответственно, после запуска  
./myScript.sh новое значение PATH не попадет в родительский шелл.

source решает эту проблему, исполняясь прямо в родительском шелле.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] script on bash
  2005-04-26 13:41 ` Шайхутдинов Дамир
@ 2005-04-26 14:17   ` Andrey Rybak
  0 siblings, 0 replies; 3+ messages in thread
From: Andrey Rybak @ 2005-04-26 14:17 UTC (permalink / raw)
  To: community


>
>
> source решает эту проблему, исполняясь прямо в родительском шелле.
>
Спасибо - это оно...


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-26 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-26 13:26 [Comm] script on bash Andrey Rybak
2005-04-26 13:41 ` Шайхутдинов Дамир
2005-04-26 14:17   ` Andrey Rybak

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git