zoukankan      html  css  js  c++  java
  • [Zsh] Create a Zsh Function to Rename Your Current Directory

    A common problem you'll run into when working inside of your terminal is the desire to rename the directory you're currently in. This is achieved in 3 steps: back out of the directory, mv to a new name, then back inside of it. Rather than 3 separate commands, let's take this down to a single command in a Zsh function. This lesson walks you through the process of creating a Zsh function to rename your current directory by using ${PWD##*/} to find the name of the directory your in then walking through the steps.

    create a new file rename-dir:

    #path/to/current/dir
    # will only return 'dir'
    currentDir=echo ${PWD##*/}
    cd ..
    mv $currentDir $1
    cd $1

    Run:

    autoload rename-dir

    Cd into a folder need to be renamed: 

    run:

    rename-dir good-name
  • 相关阅读:
    11 dubbo monitor
    svn ignore忽略文件
    Java Core Dump分析过程
    10 其他
    9 jenkins
    8 jenkins
    7 nhorizons项目结构
    6 发布个人项目到私服
    5 jenkins使用gitee
    4 Linux安装git
  • 原文地址:https://www.cnblogs.com/Answer1215/p/13157408.html
Copyright © 2011-2022 走看看