$ n="foo"; echo "{}" | jq --arg n "$n" '. += { "$n": $n }'
{
"$n": "foo"
}
我读了https://jqlang.github.io/jq/manual/#types-and-values后发现,这应该可行 —— 但显然不行。这是怎么回事?
$ n="foo"; echo "{}" | jq --arg n "$n" '. += { "$n": $n }'
{
"$n": "foo"
}
我读了https://jqlang.github.io/jq/manual/#types-and-values后发现,这应该可行 —— 但显然不行。这是怎么回事?
p=$( power )
echo "Power now: ${p}W"
印刷
Wower now: 357
这毫无意义。这肯定是一个错误吗?
root@calleva:/var/spool/cron/atjobs# echo "sleep 3000" | at 20:58
warning: commands will be executed using /bin/sh
job 161 at Sat Jun 3 20:58:00 2023
root@calleva:/var/spool/cron/atjobs# ls
a000a101acba0e
root@calleva:/var/spool/cron/atjobs# cat a000a101acba0e
#!/bin/sh
# atrun uid=0 gid=0
# mail root 0
umask 22
LANGUAGE=en_GB:en; export LANGUAGE
PWD=/var/spool/cron/atjobs; export PWD
LOGNAME=root; export LOGNAME
XDG_SESSION_TYPE=tty; export XDG_SESSION_TYPE
MOTD_SHOWN=pam; export MOTD_SHOWN
HOME=/root; export HOME
LANG=en_GB.UTF-8; export LANG
SSH_CONNECTION=192.168.0.12\ 60848\ 192.168.0.113\ 22; export SSH_CONNECTION
XDG_SESSION_CLASS=user; export XDG_SESSION_CLASS
USER=root; export USER
SHLVL=0; export SHLVL
XDG_SESSION_ID=1202; export XDG_SESSION_ID
XDG_RUNTIME_DIR=/run/user/0; export XDG_RUNTIME_DIR
SSH_CLIENT=192.168.0.12\ 60848\ 22; export SSH_CLIENT
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools:/root/bin:/opt/mssql-tools/bin:/usr/games; export PATH
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus; export DBUS_SESSION_BUS_ADDRESS
SSH_TTY=/dev/pts/5; export SSH_TTY
OLDPWD=/root; export OLDPWD
cd /var/spool/cron/atjobs || {
echo 'Execution directory inaccessible' >&2
exit 1
}
sleep 3000
root@calleva:/var/spool/cron/atjobs# atq
161 Sat Jun 3 20:58:00 2023 a root
root@calleva:/var/spool/cron/atjobs#
有没有办法告诉该文件a000a101acba0e
对应于队列项161
?
知道这应该做什么吗?
grep -lr . | xargs sed -i '' -e '/ifcfg-wlan0/!s/wlan0/<name of the device>/g'
我从未见过sed
带有五个斜杠的命令,而且我找不到任何关于它的文档。
我有一个sh
调用perl
脚本的脚本。
当我运行perl
脚本时它工作,但是当我运行脚本时sh
它无法运行perl
脚本
Permission denied
两个脚本都是chmod a+rx
,目录是chmod a+rx
. 因此这是错误的。
是什么原因造成的?
$ cat script.sh
#!/bin/sh
d=$(date +%Y-%m-%d)
cd /home/rwb/thing
ls -l script*
pwd
script.pl
$ ./script.sh
-rwxr-xr-x 1 rwb rwb 5756 Feb 14 16:04 script.pl
/home/rwb/thing
./script.sh: 8: ./script.sh: script.pl: Permission denied