Script file name in a Bash script

0 votes
Can I determine the name of the Bash script file inside the script itself? If so, How?
Jun 20 in Linux Administration by Upasana
• 8,530 points
31 views

1 answer to this question.

0 votes

$0 will give you the complete basename. So, maybe something like the following;

 echo "Your filename is $0"
answered Jun 20 by Shubham
• 13,300 points

Related Questions In Linux Administration

0 votes
1 answer

Input file name in the mapper in a Hadoop program

Try this inside your mapper : FileSplit fileSplit ...READ MORE

answered Jul 23 in Linux Administration by Shubham
• 13,300 points
138 views
0 votes
1 answer

How to take input from user in bash script?

You can use if-else branch to check ...READ MORE

answered Jan 31 in Linux Administration by Omkar
• 67,660 points
42 views
0 votes
1 answer

how to loop through the content of a file using bash

One of the ways to do it ...READ MORE

answered Feb 15 in Linux Administration by ajs3033
• 7,280 points
93 views
0 votes
1 answer

Counting lines in a file/doc.

you can do this by using word ...READ MORE

answered Mar 5 in Linux Administration by DareDev
• 6,810 points
29 views
0 votes
1 answer
0 votes
1 answer

Restart python script automatically even when it crashes in Linux

Maybe this would be more robust? 1) save ...READ MORE

answered Sep 11, 2018 in Python by Priyaj
• 56,920 points
85 views
0 votes
1 answer

Restart python script automatically even when it crashes in Linux

Maybe this would be more robust? 1) save ...READ MORE

answered Sep 21, 2018 in Python by Priyaj
• 56,920 points
408 views
0 votes
1 answer
0 votes
1 answer

Writing a heredoc to a file in a script

try to use tee: tee newfile <<EOF line 1 line 2 line ...READ MORE

answered May 20 in Linux Administration by Shubham
• 13,300 points
57 views
0 votes
1 answer