Ramanjaneyulu Gudipati
Ramanjaneyulu Gudipati

Reputation: 173

Unmatched '. error while setting up alias

I am setting an alias in Linux to print the history without the serial number and time of the command being run. This is the command to do that :

history | awk '{$1="";$2="";print}'

I am looking to set it as an alias and I see issues with Unmatched '.

$> alias oh 'history | awk \'{$1="";$2="";print}\''
Unmatched '.

Upvotes: 1

Views: 2213

Answers (1)

Barmar
Barmar

Reputation: 780871

You can't use backslash as an escape inside single quotes, only inside double quotes. You need to end the string so you can have the escaped single quotes.

alias oh 'history | awk '\''{$1="";$2="";print}'\'

Upvotes: 4

Related Questions