bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A feature request


From: Chris F.A. Johnson
Subject: Re: A feature request
Date: Tue, 23 Mar 2010 12:43:47 -0400 (EDT)
User-agent: Alpine 2.00 (LMD 1167 2008-08-23)

On Tue, 23 Mar 2010, Claes Lindvall wrote:

> Very often I create a directory and then I want to move to that directory.
> I would like an option that makes it possible.
> Ex.
> # mkdir -c <dir> (-c changedir)
> or a new command
> # mkcdir <dir>

    I use this functon to create a directory:

md()
{
  case $1 in
     -c) mkdir -p "$2" && cd "$2" ;;
     *)  mkdir -p "$@" ;;
  esac
}

    Giving the -c option changes to the new directory if it was
    created successfully.

-- 
   Chris F.A. Johnson, <http://cfajohnson.com>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]