Linux Programmer | RHCE | RHCSA

Search This Blog

Thursday, 18 November 2021

Execute custom script as command.

Create bash script, 

Create file: script.sh

#!/bin/bash 

date echo "testing" 

 

 Apply executable permission.

# chmod 0777 script.sh
 

Move script to /usr/local/bin/

# mv script.sh /usr/local/bin/

 

Now you can execute script from anywhere.

# cd /home/

# script.sh

output:

Thu Nov 18 11:05:41 IST 2021

testing


No comments:

Post a Comment

SSH not working with password after upgrade ubuntu 22.04 or above

In recent upgrade of ubuntu 22.04 and above we are not able to login server with SSH password. but when we try to login with key then it all...