⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 popd

📁 Berkely的学生写的
💻
字号:
#!/bin/sh# Chapter 14 - Functions# This script implements the csh command popd, it removes the directory# at the top of the directory stack and changes into that directory.# This implementation consists of two functions, a helper function called# _popd_helper and popd. The helper function is not ment to be called # directly by users.# To use this function you need to "source" it into your environment using# the . command_popd_helper() {    # set the directory to pop to the first argument, if     # this directory is empty, issue an error and return 1    # otherwise get rid of POPD from the arguments    POPD="$1"    if [ -z "$POPD" ] ; then        echo "ERROR: The directory stack is empty." >&2        return 1    fi    shift    # if any more arguments remain, reinitalize the directory    # stack, and then update it with the remaining items,     # otherwise set the directory stack to null    if [ -n "$1" ] ; then         _DIR_STACK="$1" ;         shift ;        for i in $@ ; do _DIR_STACK="$_DIR_STACK:$i" ; done    else        _DIR_STACK=    fi    # if POPD is a directory cd to it, otherwise issue    # an error message    if [ -d "$POPD" ] ; then        cd "$POPD" > /dev/null 2>&1        if [ $? -ne 0 ] ; then            echo "ERROR: Could not cd to $POPD." >&2        fi        pwd    else        echo "ERROR: $POPD is not a directory." >&2    fi    export _DIR_STACK    unset POPD}popd() {    OLDIFS="$IFS"    IFS=:    _popd_helper $_DIR_STACK    IFS="$OLDIFS"}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -