Answers for "bash function"

4

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
                }
Posted by: Guest on March-15-2020
2

function in bash

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

#SECOND METHOD
function Hello {
 echo 'Hello Wordl'
}
Hello
Posted by: Guest on October-27-2020
0

how to make a function in bash

function_name () {
<commands>
}
Posted by: Guest on October-21-2020
0

how to make a function in bash

print_something () {
echo Hello I am a function
}
Posted by: Guest on October-21-2020
0

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
Posted by: Guest on June-12-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language