Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

$@ bash

file:test.sh
#! /bin/sh
echo '$#' $#
echo '$@' $@
echo '$?' $?

*If you run the above script as*

> ./test.sh 1 2 3

You get output:
$#  3
$@  1 2 3
$?  0

*You passed 3 parameters to your script.*

$# = number of arguments. Answer is 3
$@ = what parameters were passed. Answer is 1 2 3
$? = was last command successful. Answer is 0 which means 'yes'
Comment

${1:?} bash

bar=${1:?First argument missing} 
# It exits with code 1 the non-interactive shell if argument 1 
# does not exist and prints the message to sterr. 
Comment

PREVIOUS NEXT
Code Example
Shell :: macbook tilbud 
Shell :: You must specify at least one graphical backend feature: "metal", "vulkan", "empty" 
Shell :: check for webhint version 
Shell :: update token key github 
Shell :: how to set chmod 777 to folder 
Shell :: To copy a directory from a local to remote system, use the -r option 
Shell :: disable public internet access linux 
Shell :: bash silent errors 
Shell :: Cloning mercurial and setting it up in your machine 
Shell :: grab between two patterns 
Shell :: Ubuntu system specificaiton 
Shell :: rename docker container 
Shell :: eacces permission denied when remove item 
Shell :: wildcard pattern multiple 
Shell :: scp two remote devices 
Shell :: To find MTP devices in Power Shell use this command: 
Shell :: ${env:windir} user profile list environment variables 
Shell :: heroku upgrade phobby basic$ 
Shell :: team vewer for ubuntu in cmd 
Shell :: how to append linux to exists flutter project 
Shell :: k logs 
Shell :: the repo coud not download 
Shell :: get or filter or ouput docker ps custom columns 
Shell :: What software can I Install after a fresh Ubuntu Setup 
Shell :: install OMV core packages on Debian 
Shell :: log cancel git command 
Shell :: Git Precommit not working on windows 
Shell :: activar w10 
Shell :: github clone mirror 
Shell :: install ecryptfs in linux 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =