Create md file if it doesn't exist yet.
This commit is contained in:
parent
22796b6c91
commit
409351aa70
1 changed files with 9 additions and 0 deletions
9
kbtd
9
kbtd
|
|
@ -61,6 +61,15 @@ fi
|
|||
|
||||
# --- Path Resolution ---
|
||||
|
||||
# Create file if it doesn't exist (but only if directory exists)
|
||||
if [[ ! -f "$FILE_PATH" ]]; then
|
||||
DIR_PATH=$(dirname "$FILE_PATH")
|
||||
if [[ ! -d "$DIR_PATH" ]]; then
|
||||
error_exit "Directory does not exist: $DIR_PATH"
|
||||
fi
|
||||
touch "$FILE_PATH"
|
||||
fi
|
||||
|
||||
# Resolve absolute path
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
ABS_PATH=$(realpath "$FILE_PATH")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue