Horje
bash get file name Code Example
bash get file name
# Basic syntax:
basename $YOURFILE

# Example usage:
YOURFILE="/path/to/your_file.txt"
basename $YOURFILE
--> your_file.txt

# Note, to remove a specified suffix from the file name, add it at the end like:
basename $YOURFILE .txt
--> your_file

# Note, to run basename in a bash script and assign the output to a variable,
# use the following syntax:
FILENAME="$(basename -- $YOURFILE)"
bash find file by name
find . -name 'mystring*'
linux strip foldder name from path
FILE="/home/vivek/lighttpd.tar.gz"
basename "$FILE"
f="$(basename -- $FILE)"
echo "$f"




Shell

Related
multiline matching regex Code Example multiline matching regex Code Example
labview multiline matching regex Code Example labview multiline matching regex Code Example
format partition to ext4 linux Code Example format partition to ext4 linux Code Example
labview match multiple lines Code Example labview match multiple lines Code Example
uninstall eclipse ubuntu 20.04 Code Example uninstall eclipse ubuntu 20.04 Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11