“Befehlszeilenargument Bash” Code-Antworten

Linux -Shell -Argumente

# bash arguments cheatsheet
$1, $2, ... -> are the positional parameters.
"$@"        -> is an array-like construct of all positional parameters, {$1, $2, $3 ...}.
"$*"        -> is the IFS expansion of all positional parameters, $1 $2 $3 ....
$#          -> is the number of positional parameters.
$-          -> current options set for the shell.
$$          -> pid of the current shell (not subshell).
$_          -> most recent parameter (or the abs path of the command to start the current shell immediately after startup).
$IFS        -> is the (input) field separator.
$?          -> is the most recent foreground pipeline exit status.
$!          -> is the PID of the most recent background command.
$0          -> is the name of the shell or shell script.
Darkstar

Befehlszeilenargument Bash

bash yourscript.sh file1 file2

yourscript.sh
inside script 

#!/bin/bash
a=$1     # = to file1
b=$2     # = file2
echo $1
echo $2
Hutch Polecat

Ähnliche Antworten wie “Befehlszeilenargument Bash”

Fragen ähnlich wie “Befehlszeilenargument Bash”

Weitere verwandte Antworten zu “Befehlszeilenargument Bash” auf Shell/Bash

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen