Skip to content

Commit

Permalink
fixed bug of temporary directory creation before listing
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardpaulus committed May 7, 2012
1 parent 55dab35 commit 1edc22d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mvedit
Expand Up @@ -3,6 +3,7 @@
# - git/svn support # - git/svn support
# - whitespace lines as delete? # - whitespace lines as delete?
# - editor switch in options (use nano if no $EDITOR value is not set) # - editor switch in options (use nano if no $EDITOR value is not set)
# - improve performance: printlineat is quite the ugly thing
if [ "$1" == "-h" -o "$1" == "-help" -o "$1" == "--help" ] if [ "$1" == "-h" -o "$1" == "-help" -o "$1" == "--help" ]
then then
echo "moves multiple files at once by letting you edit the directory listing" echo "moves multiple files at once by letting you edit the directory listing"
Expand Down Expand Up @@ -65,15 +66,15 @@ backup_on_error="$editfilename.bak"
MV_COMMAND="mv -i" MV_COMMAND="mv -i"
RM_COMMAND="rmdir_or_rm" RM_COMMAND="rmdir_or_rm"


ls -1A > "$tmpfile"
cp "$tmpfile" "$editfile"
$EDITOR "$editfile"

unique_dir "mvedit_clean_dir$RANDOM" unique_dir "mvedit_clean_dir$RANDOM"
if [ -n "$dirname" ] if [ -n "$dirname" ]
then clean_dir="$dirname" then clean_dir="$dirname"
else exit -1 else exit -1
fi fi

ls -1A > "$tmpfile"
cp "$tmpfile" "$editfile"
$EDITOR "$editfile"
nlinestmp=`wc -l "$tmpfile" | awk '{print $1}'` nlinestmp=`wc -l "$tmpfile" | awk '{print $1}'`
nlinesedit=`wc -l "$editfile" | awk '{print $1}'` nlinesedit=`wc -l "$editfile" | awk '{print $1}'`
if [ $nlinestmp -eq $nlinesedit ] if [ $nlinestmp -eq $nlinesedit ]
Expand Down

0 comments on commit 1edc22d

Please sign in to comment.