mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 13:08:49 +00:00
removed explanation of process expansion in doc
This commit is contained in:
parent
d88866ccf7
commit
f93d1c963f
3 changed files with 2 additions and 36 deletions
|
@ -9,8 +9,6 @@ bg [PID...]
|
||||||
|
|
||||||
`bg` sends <a href="index.html#syntax-job-control">jobs</a> to the background, resuming them if they are stopped. A background job is executed simultaneously with fish, and does not have access to the keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.
|
`bg` sends <a href="index.html#syntax-job-control">jobs</a> to the background, resuming them if they are stopped. A background job is executed simultaneously with fish, and does not have access to the keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.
|
||||||
|
|
||||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
|
||||||
|
|
||||||
When at least one of the arguments isn't a valid job specifier (i.e. PID),
|
When at least one of the arguments isn't a valid job specifier (i.e. PID),
|
||||||
`bg` will print an error without backgrounding anything.
|
`bg` will print an error without backgrounding anything.
|
||||||
|
|
||||||
|
@ -18,8 +16,6 @@ When all arguments are valid job specifiers, bg will background all matching job
|
||||||
|
|
||||||
\subsection bg-example Example
|
\subsection bg-example Example
|
||||||
|
|
||||||
`bg %1` will put the job with job ID 1 in the background.
|
|
||||||
|
|
||||||
`bg 123 456 789` will background 123, 456 and 789.
|
`bg 123 456 789` will background 123, 456 and 789.
|
||||||
|
|
||||||
If only 123 and 789 exist, it will still background them and print an error about 456.
|
If only 123 and 789 exist, it will still background them and print an error about 456.
|
||||||
|
|
|
@ -9,9 +9,7 @@ fg [PID]
|
||||||
|
|
||||||
`fg` brings the specified <a href="index.html#syntax-job-control">job</a> to the foreground, resuming it if it is stopped. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
|
`fg` brings the specified <a href="index.html#syntax-job-control">job</a> to the foreground, resuming it if it is stopped. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
|
||||||
|
|
||||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>. Fish is capable of expanding far more than just the numeric PID, including referencing itself and finding PIDs by name.
|
|
||||||
|
|
||||||
|
|
||||||
\subsection fg-example Example
|
\subsection fg-example Example
|
||||||
|
|
||||||
`fg %1` will put the job with job ID 1 in the foreground.
|
`fg` will put the last job in the foreground.
|
||||||
|
|
|
@ -94,7 +94,6 @@ Some characters can not be written directly on the command line. For these chara
|
||||||
- '<code>\\*</code>' escapes the star character
|
- '<code>\\*</code>' escapes the star character
|
||||||
- '<code>\\?</code>' escapes the question mark character
|
- '<code>\\?</code>' escapes the question mark character
|
||||||
- '<code>\\~</code>' escapes the tilde character
|
- '<code>\\~</code>' escapes the tilde character
|
||||||
- '<code>\\%</code>' escapes the percent character
|
|
||||||
- '<code>\\#</code>' escapes the hash character
|
- '<code>\\#</code>' escapes the hash character
|
||||||
- '<code>\\(</code>' escapes the left parenthesis character
|
- '<code>\\(</code>' escapes the left parenthesis character
|
||||||
- '<code>\\)</code>' escapes the right parenthesis character
|
- '<code>\\)</code>' escapes the right parenthesis character
|
||||||
|
@ -333,8 +332,6 @@ These are the general purpose tab completions that `fish` provides:
|
||||||
|
|
||||||
- Completion of filenames, even on strings with wildcards such as '`*`', '`**`' and '`?`'.
|
- Completion of filenames, even on strings with wildcards such as '`*`', '`**`' and '`?`'.
|
||||||
|
|
||||||
- Completion of job ID, job name and process names for <a href="#expand-process">process expansion</a>.
|
|
||||||
|
|
||||||
`fish` provides a large number of program specific completions. Most of these completions are simple options like the `-l` option for `ls`, but some are more advanced. The latter include:
|
`fish` provides a large number of program specific completions. Most of these completions are simple options like the `-l` option for `ls`, but some are more advanced. The latter include:
|
||||||
|
|
||||||
- The programs `man` and `whatis` show all installed manual pages as completions.
|
- The programs `man` and `whatis` show all installed manual pages as completions.
|
||||||
|
@ -673,31 +670,6 @@ Note that variables can be used as indices for expansion of variables, but not c
|
||||||
The `~` (tilde) character at the beginning of a parameter, followed by a username, is expanded into the home directory of the specified user. A lone `~`, or a `~` followed by a slash, is expanded into the home directory of the process owner.
|
The `~` (tilde) character at the beginning of a parameter, followed by a username, is expanded into the home directory of the specified user. A lone `~`, or a `~` followed by a slash, is expanded into the home directory of the process owner.
|
||||||
|
|
||||||
|
|
||||||
\subsection expand-process Process expansion
|
|
||||||
|
|
||||||
The `%` (percent) character at the beginning of a parameter followed by a string is expanded into a process ID (PID). The following expansions are performed:
|
|
||||||
|
|
||||||
- If the string is the entire word `self`, the shell's PID is the result.
|
|
||||||
|
|
||||||
- Otherwise, if the string is the entire word `last`, the last job's PID is the result.
|
|
||||||
|
|
||||||
- Otherwise, if the string is the ID of a job, the result is the process group ID of the job.
|
|
||||||
|
|
||||||
- Otherwise, if any child processes match the specified string, their PIDs are the result of the expansion.
|
|
||||||
|
|
||||||
- Otherwise, if any processes owned by the user match the specified string, their PIDs are the result of the expansion.
|
|
||||||
|
|
||||||
- If none of these matches apply, an error is produced.
|
|
||||||
|
|
||||||
This form of expansion is useful for commands like kill and fg, which take process IDs as arguments.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
`fg %%ema` will search for a process whose command line begins with the letters 'ema', such as emacs, and if found, put it in the foreground.
|
|
||||||
|
|
||||||
`kill -s SIGINT %3` will send the SIGINT signal to the job with job ID 3.
|
|
||||||
|
|
||||||
|
|
||||||
\subsection combine Combining different expansions
|
\subsection combine Combining different expansions
|
||||||
|
|
||||||
All of the above expansions can be combined. If several expansions result in more than one parameter, all possible combinations are created.
|
All of the above expansions can be combined. If several expansions result in more than one parameter, all possible combinations are created.
|
||||||
|
@ -1270,7 +1242,7 @@ end
|
||||||
If you want to run a set of commands when `fish` exits, use an <a href='#event'>event handler</a> that is triggered by the exit of the shell:
|
If you want to run a set of commands when `fish` exits, use an <a href='#event'>event handler</a> that is triggered by the exit of the shell:
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
function on_exit --on-process %self
|
function on_exit --on-process $fish_pid
|
||||||
echo fish is now exiting
|
echo fish is now exiting
|
||||||
end
|
end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
Loading…
Reference in a new issue