我正在尝试使用gresource extract
以下脚本提取 gnome-shell 资源:
#!/bin/bash
declare -a n;
n=$(gresource list gnome-shell-theme.gresource | cat | tr '\n' ' ')
for r in ${n[@]}
do
gresource extract gnome-shell-theme.gresource ${r}>${r/#\/org\/gnome\/shell/.}
done
但出现错误:
./extractshell.sh: line 6: ./theme/icons/eye-not-looking-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/eye-open-negative-filled-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/keyboard-caps-lock-filled-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/keyboard-enter-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/keyboard-hide-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/keyboard-layout-filled-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/keyboard-shift-filled-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/message-indicator-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/pointer-double-click-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/pointer-drag-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/pointer-primary-click-symbolic.svg: No such file or directory
./extractshell.sh: line 6: ./theme/icons/pointer-secondary-click-symbolic.svg: No such file or directory
虽然gresource list gnome-shell-theme.gresource
输出:
/org/gnome/shell/theme/calendar-today.svg
/org/gnome/shell/theme/checkbox-focused.svg
/org/gnome/shell/theme/checkbox-off-focused.svg
/org/gnome/shell/theme/checkbox-off.svg
/org/gnome/shell/theme/checkbox.svg
/org/gnome/shell/theme/dash-placeholder.svg
/org/gnome/shell/theme/gnome-shell-high-contrast.css
/org/gnome/shell/theme/gnome-shell.css
/org/gnome/shell/theme/icons/eye-not-looking-symbolic.svg
/org/gnome/shell/theme/icons/eye-open-negative-filled-symbolic.svg
/org/gnome/shell/theme/icons/keyboard-caps-lock-filled-symbolic.svg
/org/gnome/shell/theme/icons/keyboard-enter-symbolic.svg
/org/gnome/shell/theme/icons/keyboard-hide-symbolic.svg
/org/gnome/shell/theme/icons/keyboard-layout-filled-symbolic.svg
/org/gnome/shell/theme/icons/keyboard-shift-filled-symbolic.svg
/org/gnome/shell/theme/icons/message-indicator-symbolic.svg
/org/gnome/shell/theme/icons/pointer-double-click-symbolic.svg
/org/gnome/shell/theme/icons/pointer-drag-symbolic.svg
/org/gnome/shell/theme/icons/pointer-primary-click-symbolic.svg
/org/gnome/shell/theme/icons/pointer-secondary-click-symbolic.svg
/org/gnome/shell/theme/no-events.svg
/org/gnome/shell/theme/no-notifications.svg
/org/gnome/shell/theme/pad-osd.css
/org/gnome/shell/theme/process-working.svg
/org/gnome/shell/theme/toggle-off-dark.svg
/org/gnome/shell/theme/toggle-off-hc.svg
/org/gnome/shell/theme/toggle-off.svg
/org/gnome/shell/theme/toggle-on-dark.svg
/org/gnome/shell/theme/toggle-on-hc.svg
/org/gnome/shell/theme/toggle-on.svg
我不确定当列表输出显示这些文件存在时为什么会发生这种情况。我的 bash 脚本是否混乱或者可能是什么原因?谢谢。 PS - 我是一个新手,试图自定义我的 gnome-shell。
答案1
剩下的也都提取出来了。我将资源列表硬编码在一个数组中,然后直接用文件名输出。
declare -a new;
new=(/org/gnome/shell/theme/icons/eye-not-looking-symbolic.svg /org/gnome/shell/theme/icons/eye-open-negative-filled-symbolic.svg /org/gnome/shell/theme/icons/keyboard-caps-lock-filled-symbolic.svg /org/gnome/shell/theme/icons/keyboard-enter-symbolic.svg /org/gnome/shell/theme/icons/keyboard-hide-symbolic.svg /org/gnome/shell/theme/icons/keyboard-layout-filled-symbolic.svg /org/gnome/shell/theme/icons/message-indicator-symbolic.svg /org/gnome/shell/theme/icons/pointer-double-click-symbolic.svg /org/gnome/shell/theme/icons/keyboard-shift-filled-symbolic.svg /org/gnome/shell/theme/icons/pointer-drag-symbolic.svg /org/gnome/shell/theme/icons/pointer-primary-click-symbolic.svg /org/gnome/shell/theme/icons/pointer-secondary-click-symbolic.svg);
for r in ${new[@]}
do
gresource extract gnome-shell-theme.gresource ${r}>`echo ${r:29}`
done
谢谢,现在我也知道了mapfile。 @卡西莫多