Sample Header Ad - 728x90

Understanding syntax of output from alias

0 votes
0 answers
21 views
I don't understand how to read the string and the escaping of the following output from listing aliases
> alias foo="echo 'hello'"
> alias
...
alias foo='echo '\''hello'\'''
...
It doesn't make sense to me because '\' should be a string, then 'hello', but then there would be \' an escaped single quote, and then an unmatched single quote ' Probably '\'' is supposed to be just a string with an escaped ', but I thought single quotes cannot appear within single quoted strings, it will just be interpreted as the end quote
Asked by hl5619 (1 rep)
Nov 7, 2024, 03:01 AM
Last activity: Nov 7, 2024, 03:29 AM