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 :: replace main with another branch 
Shell :: add one drive to ubuntu 
Shell :: install unifi controller raspberry pi 
Shell :: how to exclude .ide directory in gitignore 
Shell :: how to update packages in arch linux 
Shell :: uninstall docker ubuntu 20.04 
Shell :: pendrive bootable using terminal 
Shell :: add new file to context menu win 10 11 
Shell :: scp 
Shell :: install sketchjs 
Shell :: error while installing DKphotogallery in xcode 
Shell :: see active apcahe conf file 
Shell :: calcul en shell 
Shell :: getssl 
Php :: human readable date laravel 
Php :: phpmailer utf8 charset 
Php :: php replace spaces with dash 
Php :: laravel project htaccess redirect to public path 
Php :: php sigmoid function 
Php :: php get current domain 
Php :: Class "AppHttpControllersGuzzle Client" not found 
Php :: automatic years php 
Php :: php get file extension from filename 
Php :: get the string after a character in php 
Php :: php parse float 2 decimal places 
Php :: macos install php 7.4 
Php :: php remove cookie 
Php :: php get elapsed time 
Php :: php get referral 
Php :: hit a simple url using curl in php 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =