Debug School

rakesh kumar
rakesh kumar

Posted on

how to make bash script file using touch in linux

To create a new bash script file using the touch command in Linux, you can follow these steps:

Open a terminal window.
Navigate to the directory where you want to create the script file.
Type the following command:

touch pull.sh
Enter fullscreen mode Exit fullscreen mode

This will create a new file named "script.sh" in the current directory.

To make the file executable, you need to give it execute permissions. You can do this using the following command:

chmod +x pull.sh
Enter fullscreen mode Exit fullscreen mode

Now you can open the file in a text editor, such as nano or vi, and add your bash commands to the file. For example, you could add the following command to print "Hello, world!" to the terminal:

echo "php artisan config:clear"
echo "php artisan migrate:install"
git pull origin master
php artisan c:cache
php artisan r:cache
php artisan v:clear
chown -R daemon:daemon
Enter fullscreen mode Exit fullscreen mode

Once you've added your commands, save the file and close the text editor.
Your bash script file is now ready to be executed by running the following command in the terminal:

./pull.sh
Enter fullscreen mode Exit fullscreen mode

Top comments (0)