[Software] [Solved] Bash with !

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
jebez
Posts: 127
Joined: 2024-07-01 15:21
Been thanked: 2 times

[Software] [Solved] Bash with !

#1 Post 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...
Last edited by jebez on 2025-01-08 22:22, edited 2 times in total.
Retired of Debian, I'm on Arch Linux btw

lindi
Debian Developer
Debian Developer
Posts: 628
Joined: 2022-07-12 14:10
Has thanked: 2 times
Been thanked: 128 times

Re: [Software] Bash with !

#2 Post 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}')"

jebez
Posts: 127
Joined: 2024-07-01 15:21
Been thanked: 2 times

Re: [Software] Bash with !

#3 Post 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.
Retired of Debian, I'm on Arch Linux btw

Post Reply