Sprawdź ścieżkę pliku Linux
pwd
readlink -f howtouselinux
find / -type f -name “howtouseilnux”
import os;os.path.abspath(“howtouseilnux”)
David Cao
pwd
readlink -f howtouselinux
find / -type f -name “howtouseilnux”
import os;os.path.abspath(“howtouseilnux”)
#!/bin/bash
########### to check for a directory ###########
path="./folder"
if [[ -d $path ]]; then
echo "$1 Directory exists"
fi
# or
[ -d "folder" ] && echo Directory exists
########### to check for a file ###########
path="./file.txt"
if [[ -f $path ]]; then
echo "$1 File exists"
fi
# or
[ -f "file.txt" ] && echo file exists