Модераторы: powerfox, ZeeLax
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Инфа по $@, $! и прочим 
V
    Опции темы
Royan
Дата 25.7.2008, 11:18 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Dreamer
***


Профиль
Группа: Участник Клуба
Сообщений: 1708
Регистрация: 14.9.2002
Где: Лондон

Репутация: нет
Всего: 15



Помогите найти статейку где бы расшифровывалось значение всех переменных начинающихся с $   я так понимаю они разнятся в зависимости от оболочки, тогда мне интересно было бы узнать что они означают в bash'e


--------------------
Открыта вакансия Junior Java Developer'а в нашем лондонском офисе, подробнее можно узнать здесь
PM MAIL MSN   Вверх
Imple
Дата 25.7.2008, 11:35 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Завсегдатай
Сообщений: 1546
Регистрация: 14.9.2007
Где: Алма-Ата

Репутация: 21
Всего: 87



Взято без особых усилий из man bash:...
Код

   Special Parameters
       The shell treats several parameters specially.  These parameters may only be referenced; assignment to them is not allowed.
       *      Expands to the positional parameters, starting from one.  When the expansion occurs within double quotes, it expands to a  single  word  with
              the  value of each parameter separated by the first character of the IFS special variable.  That is, "$*" is equivalent to "$1c$2c...", where
              c is the first character of the value of the IFS variable.  If IFS is unset, the parameters are separated by spaces.  If  IFS  is  null,  the
              parameters are joined without intervening separators.
       @      Expands  to  the positional parameters, starting from one.  When the expansion occurs within double quotes, each parameter expands to a sepa‐
              rate word.  That is, "$@" is equivalent to "$1" "$2" ...  If the double-quoted expansion occurs within a word, the  expansion  of  the  first
              parameter is joined with the beginning part of the original word, and the expansion of the last parameter is joined with the last part of the
              original word.  When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed).
       #      Expands to the number of positional parameters in decimal.
       ?      Expands to the status of the most recently executed foreground pipeline.
       -      Expands to the current option flags as specified upon invocation, by the set builtin command, or those set by the shell itself (such  as  the
              -i option).
       $      Expands to the process ID of the shell.  In a () subshell, it expands to the process ID of the current shell, not the subshell.
       !      Expands to the process ID of the most recently executed background (asynchronous) command.
       0      Expands  to  the  name of the shell or shell script.  This is set at shell initialization.  If bash is invoked with a file of commands, $0 is
              set to the name of that file.  If bash is started with the -c option, then $0 is set to the first argument after the string to  be  executed,
              if one is present.  Otherwise, it is set to the file name used to invoke bash, as given by argument zero.
       _      At  shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argu‐
              ment list.  Subsequently, expands to the last argument to the previous command, after expansion.  Also set  to  the  full  pathname  used  to
              invoke  each  command  executed and placed in the environment exported to that command.  When checking mail, this parameter holds the name of
              the mail file currently being checked.




--------------------
Не шалю, никого не трогаю, починяю сервер.
PM WWW ICQ Skype GTalk Jabber   Вверх
Royan
Дата 25.7.2008, 11:47 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Dreamer
***


Профиль
Группа: Участник Клуба
Сообщений: 1708
Регистрация: 14.9.2002
Где: Лондон

Репутация: нет
Всего: 15



Спасибо!


--------------------
Открыта вакансия Junior Java Developer'а в нашем лондонском офисе, подробнее можно узнать здесь
PM MAIL MSN   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Правила форума "Linux/UNIX: Oбщие вопросы"
nickless
Imple
nerezus

В тему здесь вопросы общие - не привязанные к определенному ПО или дистрибутиву BSD/Linux/UNIX.
Например вопросы о выборе ОС для определенных задач (но если Вы просто хотите узнать "Какой дистрибутив лучше", то для этого есть Клуб юнуксоидов).
Общие вопросы по shell-программированию тоже лучше задавать здесь.


  • Вопросы мобильной разработки тут
  • Вы должны соблюдать правила форума.
  • Помните: какой вопрос, такой и ответ. Прежде чем задать вопрос прочитайте вот эту статью на форуме CIT.
  • Оскорблять запрещается.
  • Религиозные войны в Религиозных войнах.
  • Общение "просто так" в Клубе юнуксоидов. В отличие от многих других разделов, здесь разрешается сдержанно оффтопить и юморить в тему.

За интересные статьи, находки, решения, программы и просто реальную помощь будут ставиться + в репу).


В данный момент этот раздел модерируют nerezus, nickless, powerfox, pythonwin, Imple и ZeeLax. Если вы хотите помочь нам, пишите в ПМ и мы обсудим.


Спасибо. И use UNIX or die; С уважением, nerezus, nickless, powerfox, pythonwin, Imple, ZeeLax.

 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | *NIX системы: Общие вопросы | Следующая тема »


 




[ Время генерации скрипта: 0.0420 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.