The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Поиск:  Каталог документации

3.12. Backticks (`...`)

Command substitution

Commands within backticks generate command line text.

The output of commands within backticks can be used as arguments to another command or to load a variable.
rm `cat filename`
# "filename" contains a list of files to delete.

textfile_listing=`ls *.txt`
# Variable contains names of all *.txt files in current working directory.
echo $textfile_listing

Incrementing / decrementing variables (commonly used with expr)

z=`expr $z + 3`
Note that this particular use of backticks has been superseded by double parentheses $((...)) or the very convenient let construction.

let z=z+3
let "z += 3"  #If quotes, then spaces and special operators allowed.
All these are equivalent. You may use whichever one "rings your chimes".

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2022 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру