'nest '"'single quotes'"' instead?alias server_uptime='ssh $host 'uptime -p''alias server_uptime='ssh $host '"'uptime -p'"In the first case, the user has four single quotes on a line, wishfully hoping that the shell will match them up as outer quotes around a string with literal single quotes:
# v--------match--------v
alias server_uptime='ssh $host 'uptime -p''
# ^--match--^The shell, meanwhile, always terminates single quoted strings at the first possible single quote:
# v---match--v
alias server_uptime='ssh $host 'uptime -p''
# ^^Which is the same thing as
alias server_uptime='ssh $host uptime' -p.
There is no way to nest single quotes. However, single quotes can be placed literally in double quotes, so we can instead concatenate a single quoted string and a double quoted string:
# v--match---v
alias server_uptime='ssh $host '"'uptime -p'"
# ^---match---^This results in an alias with embedded single quotes.
None.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.