Les Partages de Memiks
Tag cloud
Picture wall
Daily
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
Rename files in linux / bash using mv command without typing the full name two times https://gist.github.com/premek/6e70446cfc913d3c929d7cdbfe896fef
Tue Apr 14 07:10:36 2020 archive.org
QRCode
thumbnail

Put this function to your .bashrc file.

Usage: mv oldfilename

If you call mv without the second parameter it will prompt you to edit the filename on command line.

Original mv is called when it's called with more than one argument.

It's useful when you want to change just a few letters in a long name.

function mv() {

  if [ "$#" -ne 1 ]; then

    command mv "$@"

    return

  fi

  if [ ! -f "$1" ]; then

    command file "$@"

    return

  fi

  read -ei "$1" newfilename

  mv -v "$1" "$newfilename"

}

4769 links, including 1683 private
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Theme by kalvn