I have tried adding a additional quote like" /> I have tried adding a additional quote like" /> I have tried adding a additional quote like"/>

capture special characters ! in echo command for zsh

102 Views Asked by At

I am trying to capture a string in mac terminal zsh

when i try

echo "abc1234!"      

It would prompt for dquote>

I have tried adding a additional quote like this

echo "abc1234!""

Output

abc1234

how do i capture ! character in the string ??

1

There are 1 best solutions below

0
user1934428 On

Either turn off history expansion with

setopt nobanghist

, or escape the !character:

echo "abc1234\!"