Background
When you create and execute procedures for the Linux server, enter a comment at the prompt as appropriate to execute the command to make the term log easier to understand.
For example, if the login shell is /bin/bash, you can enter the following at the prompt to make the comment:
# Output hostname
umame-n
events
However, if the login shell is /bin/csh, entering a comment at the prompt as described above will be treated as a command and result in an error.
Also, as a csh script, "#(sharp)" is correctly treated as a comment when shelled.
What do you want to check
If the login shell is csh
What do you know now
<2. How to comment on the prompt
Preliminary action to prevent processing by using ":(colon)"
: '#Output hostname'
umame-n
"In this case, ""interactive shell"" is more appropriate as a term than ""prompt"", so let's replace it like that
"Why can't I treat "# (sharp)" as a comment at the prompt?
Can't it be because of the csh
and tcsh
specifications?It is estimated that @metropolis's link does not require comments to be entered in an interactive shell.
How to Comment on Prompts
Transfer to the If you're making a manual for beginners to read, I think it's better to write only the characters that should be entered and returned on the log, but the explanation should not be confusing (people who copy sutra will be able to type this kind of thing here!) I personally do not use bourne-shell
line!It is definitely quick and there will be no confusion in the future.
If everything has to be csh
, as pointed out, :
colons and true
are both commands that ignore all arguments and return success (as built-in or external) to type number if you want to treat them like comments.
csh
as the login shell, and I do not recommend it to my colleagues.It is impossible to write "shell scripts" in csh
, and it is recommended that you switch to bash
using the chsh
command.
© 2024 OneMinuteCode. All rights reserved.