← 返回命令列表

Linux command

csh 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start an interactive

csh

Execute a C shell script

csh [script.csh]

Execute commands from a string

csh -c "[echo Hello; echo World]"

Start a login shell

csh -l

Execute script with verbose

csh -v [script.csh]

Execute script with command

csh -x [script.csh]

说明

csh (C shell) is a Unix shell with C-like syntax, featuring job control, command history, and aliasing. It was designed to be more user-friendly than the Bourne shell while providing a syntax familiar to C programmers. The shell provides interactive features like history substitution (!!, !$), command completion, and aliases. Its scripting syntax differs significantly from Bourne-style shells, using C-like constructs for conditionals and loops. Configuration files include ~/.cshrc (read for every shell) and ~/.login (read for login shells). The shell sets various environment variables and provides built-in commands for job control and directory navigation.

参数

-c _STRING_
Execute commands from the string.
-e
Exit immediately if any command fails.
-f
Fast start; don't read .cshrc.
-i
Force interactive mode.
-l
Act as a login shell.
-n
Parse but don't execute commands (syntax check).
-s
Read commands from standard input.
-v
Verbose mode; print commands before execution.
-x
Echo commands after variable substitution.
-V
Verbose mode before reading .cshrc.
-X
Echo mode before reading .cshrc.

FAQ

What is the csh command used for?

csh (C shell) is a Unix shell with C-like syntax, featuring job control, command history, and aliasing. It was designed to be more user-friendly than the Bourne shell while providing a syntax familiar to C programmers. The shell provides interactive features like history substitution (!!, !$), command completion, and aliases. Its scripting syntax differs significantly from Bourne-style shells, using C-like constructs for conditionals and loops. Configuration files include ~/.cshrc (read for every shell) and ~/.login (read for login shells). The shell sets various environment variables and provides built-in commands for job control and directory navigation.

How do I run a basic csh example?

Run `csh` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c _STRING_ do in csh?

Execute commands from the string.