Home > OS >  Using $0 for the shell script file name is not correct
Using $0 for the shell script file name is not correct

Time:10-28

In the shell script for the current script file name
Input echo $0
Use the dot notation or the source running script
The result, but is shown - KSH, but is not what you want
For the other methods for this shell file name

CodePudding user response:

#!/bin/bash
Echo $(the basename $BASH_SOURCE)


You can try
  • Related