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, 2019 in Linux Administration by Upasana
• 8,570 points
40 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, 2019 by Shubham
• 13,370 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, 2019 in Linux Administration by Shubham
• 13,370 points
225 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, 2019 in Linux Administration by Omkar
• 68,840 points
58 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, 2019 in Linux Administration by ajs3033
• 7,280 points
129 views
0 votes
1 answer

Counting lines in a file/doc.

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

answered Mar 5, 2019 in Linux Administration by DareDev
• 6,810 points
35 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
• 57,450 points
102 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
• 57,450 points
658 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, 2019 in Linux Administration by Shubham
• 13,370 points
77 views
0 votes
1 answer

How to extract file base name without path and extension in bash?

You don't actually have to call the ...READ MORE

answered May 31, 2019 in Linux Administration by Shubham
• 13,370 points
230 views