Let's Create Own Simple Command 001

kojikanao profile image Koji (he/him) Updated on ・1 min read

I'm lazy so I didn't make a gif file..., but you can see what the command I made could do.

~/Desktop/dev ls                                                            
~/Desktop/dev mkdird dev.to                                                 
~/Desktop/dev ls                                                            


name: mkdird

arg: string

function: make a folder which names arg_date

First, I tried to add a command to .zshrc as an alias, but it didn't work well since I could not pass arg to the command. Then switched creating .sh file and create a new alias.

Step 1 Create bash/zsh file

$ cd
$ mkdir .sh
$ vim mkdird.sh
#!/usr/bin/env zsh
# create a folder --> arg_date
mkdir $1`date '+_%m%d_%H%M'`

Step 2 Add a new alias


alias mkdird="~/.sh/mkdird.sh"

Step 3 Test


$ mkdird dev.to


Posted on by:

kojikanao profile

Koji (he/him)


Looking for opportunities! Software Engineer in NYC/Research Resident@NYU-ITP18-19 Mostly I work with reactjs and sometimes python. code to do something weird/useless/helpful Japanese


markdown guide