Multiple fixes: pathname handling #1
+14
-7
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Simple script for the terminal that mimics the operation of AdvancedNewFile (Vim plugin)
|
# Simple script for the terminal that mimics the operation of AdvancedNewFile (Vim plugin)
|
||||||
@@ -7,9 +7,16 @@
|
|||||||
# License: MIT
|
# License: MIT
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ "$@" == */ ]]; then
|
|
||||||
mkdir -p $@
|
for f in "$@"
|
||||||
else
|
do
|
||||||
for f in "$@"; do mkdir -p "$(dirname "$f")"; done
|
dir="${f%/*}"
|
||||||
touch "$@"
|
file="${f##*/}"
|
||||||
fi
|
|
||||||
|
if [ -n "$dir" ]; then
|
||||||
|
mkdir -p "$dir"
|
||||||
|
fi
|
||||||
|
if [ -n "$file" ]; then
|
||||||
|
touch "./$dir/$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user