Hello i want a simple shell script that find the name of the file from a given path of the file. like
$path = "/var/www/html/test.php";
then i want to get value "test" in some variable. Also only .php files are present.I am using bash shell. Thanks
Try:
path="/var/www/html/test.php"
name=$(basename "$path" ".php")
echo "$name"
The quotes are only there to prevent problems when $path
contains spaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With