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,620 points
107 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,480 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,480 points
1,088 views
0 votes
1 answer

How to find the first field from a file in Bash Shell?

Hi@akhtar, You can extract text from a file. ...READ MORE

answered Oct 19, 2020 in Linux Administration by MD
• 95,060 points
71 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
• 69,090 points
203 views
0 votes
2 answers

how to loop through the content of a file using bash

#!/bin/bash for i in  `cat peptides.txt` do echo $i done READ MORE

answered Sep 4, 2020 in Linux Administration by Prakash K. Aithal
1,121 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
• 58,100 points
1,064 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
• 58,100 points
2,280 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,480 points
466 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,480 points
2,924 views