Совет дня:
Разные варианты команды
опубликовано в @gitgate
#tips #grep
Разные варианты команды
grep и ключи для смены режимов в базовом grepgrep = grep -G # базовое регулярное выражение (BRE)
fgrep = grep -F # фиксированный текст, игнорирующий мета-символы
egrep = grep -E # расширенное регулярное выражение (ERE)
rgrep = grep -r # рекурсивный
опубликовано в @gitgate
#tips #grep
👍22🔥7
Совет дня:
Звуковой сигнал в консоли заданного тона и длительности. Например для оповещений об ошибках.
Вообще интересная утилитка, позволяющая проигрывать и WAV, и раздельно левый правый канал и много чего еще.
опубликовано в @gitgate
#tips #speaker #beep
Звуковой сигнал в консоли заданного тона и длительности. Например для оповещений об ошибках.
TONE=3500 #от 500 до 3500
(speaker-test -t sine -f $TONE) & pid=$!;sleep 0.1s;kill -9 $pid
Вообще интересная утилитка, позволяющая проигрывать и WAV, и раздельно левый правый канал и много чего еще.
опубликовано в @gitgate
#tips #speaker #beep
👍15🔥8
Совет дня:
Условные выражения для файлов в
PS. в линукс все есть файл или поток :)
PPS. И переменные окружения.
опубликовано в @gitgate
#tips #bash
Условные выражения для файлов в
bash## True if file exists.
[[ -a ${file} ]]
## True if file exists and is a block special file.
[[ -b ${file} ]]
## True if file exists and is a character special file.
[[ -c ${file} ]]
## True if file exists and is a directory.
[[ -d ${file} ]]
## True if file exists.
[[ -e ${file} ]]
## True if file exists and is a regular file.
[[ -f ${file} ]]
## True if file exists and is a symbolic link.
[[ -h ${file} ]]
## True if file exists and is readable.
[[ -r ${file} ]]
## True if file exists and has a size greater than zero.
[[ -s ${file} ]]
## True if file exists and is writable.
[[ -w ${file} ]]
## True if file exists and is executable.
[[ -x ${file} ]]
## True if file exists and is a symbolic link.
[[ -L ${file} ]]
PS. в линукс все есть файл или поток :)
PPS. И переменные окружения.
опубликовано в @gitgate
#tips #bash
👍39🔥13
Совет дня:
Условные выражения для строковых переменных в
опубликовано в @gitgate
#tips #bash
Условные выражения для строковых переменных в
bash# True if the shell variable varname is set (has been assigned a value).
[[ -v ${varname} ]]
# True if the length of the string is zero.
[[ -z ${string} ]]
# True if the length of the string is non-zero.
[[ -n ${string} ]]
# True if the strings are equal. = should be used with the test command for POSIX conformance. When used with the [[ command, this performs pattern matching as described above (Compound Commands)
[[ ${string1} == ${string2} ]]
# True if the strings are not equal.
[[ ${string1} != ${string2} ]]
# True if string1 sorts before string2 lexicographically.
[[ ${string1} < ${string2} ]]
# True if string1 sorts after string2 lexicographically.
[[ ${string1} > ${string2} ]]
опубликовано в @gitgate
#tips #bash
👍32🔥10