when trying to run shutdown -p, i get a Bad substituion 20 September 2021, 16:06:28 when trying to run:shutdown -p or any of the shutdown flagsI get a /usr/bin/shutdown: 43: Bad substitutionanyone know how to solve this?
Re: when trying to run shutdown -p, i get a Bad substituion Reply #1 – 20 September 2021, 16:36:20 Quote from: kronikpillow – on 20 September 2021, 16:06:28when trying to run:shutdown -p or any of the shutdown flagsI get a /usr/bin/shutdown: 43: Bad substitutionanyone know how to solve this?I just tried : shutdown -p now and have no issue.
Re: when trying to run shutdown -p, i get a Bad substituion Reply #2 – 20 September 2021, 16:47:11 Quote from: kronikpillow – on 20 September 2021, 16:06:28when trying to run:shutdown -p or any of the shutdown flagsI get a /usr/bin/shutdown: 43: Bad substitutionanyone know how to solve this?What is the output ofCode: [Select]$ ls -l /usr/bin/shon your system? If it's different than bash, symlink /usr/bin/bash to /usr/bin/sh and try again.
Re: when trying to run shutdown -p, i get a Bad substituion Reply #3 – 20 September 2021, 22:52:11 I use dash as it's faster then bash, but my login and interactive shell is ZSH, I would like to stay with dash as my /bin/sh ... is there a way i can work around this?
Re: when trying to run shutdown -p, i get a Bad substituion Reply #4 – 20 September 2021, 22:53:36 Quote from: kronikpillow – on 20 September 2021, 22:52:11I use dash as it's faster then bash, but my login and interactive shell is ZSH, I would like to stay with dash as my /bin/sh ... is there a way i can work around this?That is probably why you are having this issue. You'd possibly have to re-write the shutdown script to work with dash
Re: when trying to run shutdown -p, i get a Bad substituion Reply #5 – 20 September 2021, 23:34:49 Quote from: kronikpillow – on 20 September 2021, 22:52:11I use dash as it's faster then bash, In this case, it seems like it is breaking the system, which makes the other options better.If you need a lightweight shell, I use mksh (MirBSD Korn Shell) for both /bin/sh and interactive use, and I don't have issues.
Re: when trying to run shutdown -p, i get a Bad substituion Reply #6 – 20 September 2021, 23:35:11 so the 66 utils were written in bash? what a headache, then possibly other 66 utils might have issues with dash as well? I am not well versed in scripting, I might as well just do a call to dash in my scripts that i want running trough dash to avoid the issue
Re: when trying to run shutdown -p, i get a Bad substituion Reply #7 – 20 September 2021, 23:40:35 I think it's just an error in 66. The scripts do have a #!/bin/sh shebang. Running checkbashisms on the shutdown script, it gives me this output.Code: [Select]possible bashism in shutdown_script line 43 (${foo:3[:1]}):[ ${1:0:1} != '-' ] && dieThe second one is definitely bash specific not sure about the first one. Probably worth an upstream bug report at any rate. Maybe there are others.
Re: when trying to run shutdown -p, i get a Bad substituion Reply #8 – 20 September 2021, 23:51:44 yeah i just changed the shebang on the shutdown script from /bin/sh to /bin/bash and solved the problem, I will file a upstream bug report ... but I am new to 66 utils, how do i easiest identify scripts that belong to Obarun?
Re: when trying to run shutdown -p, i get a Bad substituion Reply #9 – 21 September 2021, 00:00:33 Well all the init-specific stuff (shutdown, reboot, poweroff, etc.) are all Obarun. In s6-linux-init these are all written using execline not shell.
Re: when trying to run shutdown -p, i get a Bad substituion Reply #10 – 21 September 2021, 00:03:51 /usr/bin/reboot and /usr/bin/poweroff are execlineb ... what ever that is
Re: when trying to run shutdown -p, i get a Bad substituion Reply #11 – 21 September 2021, 00:40:07 if this is the correct link to upstream it seems to me that the only script in the 66 repo related to init that was written in shell is shutdown, so I'll file a bug report if that is the correct url, but a temp solution is to change the shebang from /bin/sh to /bin/bash to who ever encounters the same problem
Re: when trying to run shutdown -p, i get a Bad substituion Reply #12 – 21 September 2021, 04:08:22 I added a patch locally to set it to bash, which will hit mirrors once they sync.
Re: when trying to run shutdown -p, i get a Bad substituion Reply #13 – 21 September 2021, 05:36:48 Quote from: kronikpillow – on 21 September 2021, 00:40:07if this is the correct link to upstream it seems to me that the only script in the 66 repo related to init that was written in shell is shutdown, so I'll file a bug report if that is the correct url, but a temp solution is to change the shebang from /bin/sh to /bin/bash to who ever encounters the same problem Yup that's upstream.
Re: when trying to run shutdown -p, i get a Bad substituion Reply #14 – 21 September 2021, 12:24:07 [ ${1:0:1} != '-' ] && die could be replaced by a call to sed:Code: [Select][ "$(echo $1 | sed 's/^\(.\).*/\1/')" != '-' ] && dieThe difference is that sed is (usually) an external program, which might not even be installed on the system, compared to Bash built-in substring expansion (man bash, then /Substring Expansion).