Multiple fixes: pathname handling #1

Merged
grimreaper merged 1 commits from patch-2 into master 2017-12-20 08:09:51 +01:00
Showing only changes of commit 78aacafad4 - Show all commits
+14 -7
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
#
# Simple script for the terminal that mimics the operation of AdvancedNewFile (Vim plugin)
@@ -7,9 +7,16 @@
# License: MIT
#
if [[ "$@" == */ ]]; then
mkdir -p $@
else
for f in "$@"; do mkdir -p "$(dirname "$f")"; done
touch "$@"
fi
for f in "$@"
do
dir="${f%/*}"
file="${f##*/}"
if [ -n "$dir" ]; then
mkdir -p "$dir"
fi
if [ -n "$file" ]; then
touch "./$dir/$file"
fi
done