Следите за новостями русскоязычного сообщества Ubuntu в Twitter-ленте @ubuntu_ru_loco
0 Пользователей и 1 Гость просматривают эту тему.
ls /path
Или имеется ввиду хоть 1 файл в папке?
Цитата: Azure от 09 Октября 2015, 21:29:26Или имеется ввиду хоть 1 файл в папке?Именно так.
ls -1 targetdir | wc -l
[[ $(echo -n папка/*) =~ [*] ]]
это ссылка на собственный хомяк пользователя
if ls папка/* &>/dev/null; then echo OKfi
что означает знак ~ в bash.
Tilde Expansion If a word begins with an unquoted tilde character (`~'), all of the characters preceding the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the tilde are treated as a possible login name. If this login name is the null string, the tilde is replaced with the value of the shell parameter HOME. If HOME is unset, the home directory of the user executing the shell is substituted instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name. If the tilde-prefix is a `~+', the value of the shell variable PWD replaces the tilde-prefix. If the tilde-prefix is a `~-', the value of the shell variable OLDPWD, if it is set, is substituted. If the characters following the tilde in the tilde-prefix consist of a number N, optionally prefixed by a `+' or a `-', the tilde-prefix is replaced with the corresponding element from the directory stack, as it would be displayed by the dirs builtin invoked with the tilde-prefix as an argument. If the characters following the tilde in the tilde-prefix consist of a number without a leading `+' or `-', `+' is assumed. If the login name is invalid, or the tilde expansion fails, the word is unchanged. Each variable assignment is checked for unquoted tilde-prefixes immediately following a : or the first =. In these cases, tilde expansion is also performed. Consequently, one may use filenames with tildes in assignments to PATH, MAILPATH, and CDPATH, and the shell assigns the expanded value.
А смысл такой команды какой?
Ну напримерКод: (bash) [Выделить][[ $(echo -n папка/*) =~ [*] ]]без учета скрытых файлов и включая директории
=~ [*]
du -sb dir
du -s dir
Страница сгенерирована за 0.066 секунд. Запросов: 25.