Skip to main content
added 84 characters in body
Source Link
Kusalananda
  • 338.9k
  • 37
  • 682
  • 991

Put the name in single quotes. This makes the shell not process backslashes or things that look like expansions in the string.

For each embedded single quote, temporarily break out of the single-quoted string and add a quoted single quote (this essentially means replacing each single quote with '\'' or '"'"' on the command line):

$ touch '"\?$*'\''ChouMi'\''*$?\"'
$ ls
"\?$*'ChouMi'*$?\"

Similarily if you need the name in a variable:

$ name='"\?$*'\''ChouMi'\''*$?\"'
$ touch "$name"
$ ls
"\?$*'ChouMi'*$?\"

(Note that the quoting of $name whenever that value is used is essential.)

Somewhat related:

Put the name in single quotes. This makes the shell not process backslashes or things that look like expansions in the string.

For each embedded single quote, temporarily break out of the single-quoted string and add a quoted single quote (this essentially means replacing each single quote with '\'' or '"'"' on the command line):

$ touch '"\?$*'\''ChouMi'\''*$?\"'
$ ls
"\?$*'ChouMi'*$?\"

Similarily if you need the name in a variable:

$ name='"\?$*'\''ChouMi'\''*$?\"'
$ touch "$name"
$ ls
"\?$*'ChouMi'*$?\"

(Note that the quoting of $name whenever that value is used is essential.)

Put the name in single quotes. This makes the shell not process backslashes or things that look like expansions in the string.

For each embedded single quote, temporarily break out of the single-quoted string and add a quoted single quote (this essentially means replacing each single quote with '\'' or '"'"' on the command line):

$ touch '"\?$*'\''ChouMi'\''*$?\"'
$ ls
"\?$*'ChouMi'*$?\"

Similarily if you need the name in a variable:

$ name='"\?$*'\''ChouMi'\''*$?\"'
$ touch "$name"
$ ls
"\?$*'ChouMi'*$?\"

(Note that the quoting of $name whenever that value is used is essential.)

Somewhat related:

added 80 characters in body
Source Link
Kusalananda
  • 338.9k
  • 37
  • 682
  • 991

Put the name in single quotes. For This makes the shell not process backslashes or things that look like expansions in the string.

For each embedded single quote, temporarily break out of the single-quoted string and add a quoted single quote (this essentially means replacing each single quote with '\'' or '"'"' on the command line):

$ touch '"\?$*'\''ChouMi'\''*$?\"'
$ ls
"\?$*'ChouMi'*$?\"

Similarily if you need the name in a variable:

$ name='"\?$*'\''ChouMi'\''*$?\"'
$ touch "$name"
$ ls
"\?$*'ChouMi'*$?\"

(Note that the quoting of $name whenever that value is used is essential.)

Put the name in single quotes. For each embedded single quote, temporarily break out of the single-quoted string and add a quoted single quote (this essentially means replacing each single quote with '\'' or '"'"' on the command line):

$ touch '"\?$*'\''ChouMi'\''*$?\"'
$ ls
"\?$*'ChouMi'*$?\"

Similarily if you need the name in a variable:

$ name='"\?$*'\''ChouMi'\''*$?\"'
$ touch "$name"
$ ls
"\?$*'ChouMi'*$?\"

Put the name in single quotes. This makes the shell not process backslashes or things that look like expansions in the string.

For each embedded single quote, temporarily break out of the single-quoted string and add a quoted single quote (this essentially means replacing each single quote with '\'' or '"'"' on the command line):

$ touch '"\?$*'\''ChouMi'\''*$?\"'
$ ls
"\?$*'ChouMi'*$?\"

Similarily if you need the name in a variable:

$ name='"\?$*'\''ChouMi'\''*$?\"'
$ touch "$name"
$ ls
"\?$*'ChouMi'*$?\"

(Note that the quoting of $name whenever that value is used is essential.)

Source Link
Kusalananda
  • 338.9k
  • 37
  • 682
  • 991

Put the name in single quotes. For each embedded single quote, temporarily break out of the single-quoted string and add a quoted single quote (this essentially means replacing each single quote with '\'' or '"'"' on the command line):

$ touch '"\?$*'\''ChouMi'\''*$?\"'
$ ls
"\?$*'ChouMi'*$?\"

Similarily if you need the name in a variable:

$ name='"\?$*'\''ChouMi'\''*$?\"'
$ touch "$name"
$ ls
"\?$*'ChouMi'*$?\"