Существует debian мультимедийный репозиторий, который имеет многие 'неподдерживаемые' мультимедийные приложения и библиотеки.
Для Вашего/etc/apt/sources.list (лучше, чтобы вставить файл в/etc/apt/sources.list.d)
deb http://www.deb-multimedia.org/ testing main non-free
deb-src http://www.deb-multimedia.org/ testing main non-free
Работы хорошо для меня, проверьте веб-сайт (тот же адрес) для получения дополнительной информации о различных debian версиях.
Я добавил, что те строки, плюс некоторые пояснительные тексты в файл, сохраненный в/etc/apt/sources.list.d/multimedia.list, работают очень хорошо. Существуют ограничения на то, чем можно назвать файл, см. sources.list (5) для получения дополнительной информации.
$0
просто внутренняя переменная удара. От man bash
:
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 exe‐
cuted, if one is present. Otherwise, it is
set to the file name used to invoke bash, as
given by argument zero.
Так, $0
полное имя Вашего сценария, например /home/user/scripts/foobar.sh
. Так как Вы часто не хотите полного пути, но просто названия самого сценария, Вы используете basename
удалить путь:
#!/usr/bin/env bash
echo "\$0 is $0"
echo "basename is $(basename $0)"
$ /home/terdon/scripts/foobar.sh
$0 is /home/terdon/scripts/foobar.sh
basename is foobar.sh
;
только действительно необходим в ударе, если Вы пишете несколько операторов на той же строке. Это не нужно где угодно в Вашем примере:
#!/usr/bin/env bash
## Multiple statements on the same line, separate with ';'
for i in a b c; do echo $i; done
## The same thing on many lines => no need for ';'
for i in a b c
do
echo $i
done
Что делает
$0
средний?
От man bash
, раздел PARAMETERS
, подраздел Special Parameters
:
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 com‐
mands, $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.
Это говорит 0
там, но $0
предназначен потому что $
определяет параметр.
Можно найти такую информацию в страницах справочника легко при помощи ключа поиска /
. Просто введите /\$0
сопровождаемый обратной почтой. $
должен быть заключен в кавычки как \$
в этом случае, потому что $
имеет особое значение при поиске, и обратная косая черта необходима, чтобы "выйти" из этого особого значения.
В какой случаи""; используется в конце оператора в сценарии?
Обычно только, когда Вы хотите поместить по крайней мере два оператора в одну строку, например, это было бы случаем, где можно использовать ;
:
if [ $i = $myname ]; then
Нет никакого случая в Вашем сценарии в качестве примера где ;
требуется, можно удалить его из первой строки. Детали могут снова быть найдены в man bash
:
Lists
A list is a sequence of one or more pipelines separated by one of the
operators ;, &, &&, or ||, and optionally terminated by one of ;, &, or
<newline>.
[...]
A sequence of one or more newlines may appear in a list instead of a
semicolon to delimit commands.
If a command is terminated by the control operator &, the shell exe‐
cutes the command in the background in a subshell. The shell does not
wait for the command to finish, and the return status is 0. Commands
separated by a ; are executed sequentially; the shell waits for each
command to terminate in turn. The return status is the exit status of
the last command executed.