Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash function

foo () {
    echo $1  # $1 is the first argument
}
foo

# alternative way
function foo {
	echo $1
}
foo
Comment

bash function

#!/bin/bash

function greet {
 echo "Hi there!"
}

greet
Comment

function in bash

#FIRST METHOD
Hello () {  
  echo 'Hello Wordl'  
}  
Hello 

#SECOND METHOD
function Hello {
 echo 'Hello Wordl'
}
Hello
Comment

bash function

                #!/bin/bash 
                
                #Call a function without arguments
                function quit {
                   exit
                }
                
                #Call a function with arguments
                function e {
                    echo $1 #$1 will be set to the first argument given
                }  
                

           
Comment

how to make a function in bash

function_name () {
<commands>
}
Comment

function in bash

killport(){ 

sudo kill -9 $(sudo fuser -n tcp $1 2> /dev/null);

}

Now put this function in your bash configuration file, eg ~/.bashrc and then run:

source  ~/.bashrc
Comment

how to make a function in bash

print_something () {
echo Hello I am a function
}
Comment

bash functions

#!/bin/bash

hello_world () {
   echo 'hello, world'
}
Comment

PREVIOUS NEXT
Code Example
Shell :: grep until third match 
Shell :: kubernetes clusterip 
Shell :: how to uninstall in ubuntu 
Shell :: docker force new build without cache 
Shell :: github status 
Shell :: zsh ubuntu 
Shell :: git unstage 
Shell :: remove ADS 
Shell :: grep search match in all files in folder 
Shell :: unix file systems 
Shell :: shopify cli 
Shell :: remove folders from remote git 
Shell :: bash measure execution time 
Shell :: start with in shell script 
Shell :: bokeh install 
Shell :: show changes done by a user git bash 
Shell :: exit django shell 
Shell :: send tag to remote git 
Shell :: Install docker EE without internet 
Shell :: ned red installation guide ubuntu 
Shell :: linux get notification if bettery full 
Php :: if language wpml 
Php :: error reporting in php 
Php :: php string to lowercase 
Php :: phpinfo file 
Php :: htaccess post max size 
Php :: wordpress error log 
Php :: bcmath php extension in ubuntu 
Php :: how to use old for select in blade laravel 
Php :: get current datatime laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =