Page 1 of 1

[Software] [Solved] Bash with !

Posted: 2025-01-08 12:43
by jebez
We have:
!
$(ls /boot/vmlinuz-*-amd64) 'abc' $(ls -l /dev/disk/by-uuid|grep nvme0n1p3|head -n 1|awk '{print$9}'


Output:

Code: Select all

!
$(ls /boot/vmlinuz-*-amd64) 'abc' 5692-CD2D
Trying:

Code: Select all

echo -e "!\n\$(ls /boot/vmlinuz-*-amd64) 'abc' $(ls -l /dev/disk/by-uuid|grep nvme0n1p3|head -n 1|awk '{print$9}')"
-bash: !/\n: event not found

Code: Select all

echo -e "\!\n\$(ls /boot/vmlinuz-*-amd64) 'abc' $(ls -l /dev/disk/by-uuid|grep nvme0n1p3|head -n 1|awk '{print$9}')"
\!
$(ls /boot/vmlinuz-*-amd64) 'abc' 5692-CD2D
What is an event here? How to do?

https://stackoverflow.com/questions/669 ... es-in-bash.

btw I'm annoyed with that because of https://github.com/storaged-project/udisks/issues/1337, viewtopic.php?t=161440 (should be in General Debian, my bad, move it) not done.

Update:
No longer needed, I use /etc/fstab. But the question remains...

Re: [Software] Bash with !

Posted: 2025-01-08 20:33
by lindi
You can do

Code: Select all

echo -e '!'"\n\$(ls /boot/vmlinuz-*-amd64) 'abc' $(ls -l /dev/disk/by-uuid|grep nvme0n1p3|head -n 1|awk '{print$9}')"

Re: [Software] Bash with !

Posted: 2025-01-08 22:21
by jebez
Nice! Thanks.

Code: Select all

echo -e '#!'/bin/sh'\'n'$(ls /boot/vmlinuz-*-amd64)' 'abc' $(ls -l /dev/disk/by-uuid|grep nvme0n1p3|head -n 1|awk '{print$9}')
works.