8 Star 19 Fork 5

hotmocha / minitalk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
opdir 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
hotmocha 提交于 2016-02-02 14:18 . add some shell
function popd
{
mypath="/home/app2/dep_sjq/tmp/tmpfj"
current_pid=$$
parent_id=$(ps -o pid,ppid,comm | grep $current_pid | awk -v current_pid_var=$current_pid '$1==current_pid_var{print $2}')
file="$mypath/${parent_id}.dir"
if [ -f "$file" ]
then
path=`head -n 1 $file`
if [ -z "$path" ]; then
echo 'empty stack'
return;
else
cd $path
content=`sed '1d' "$file"`
echo "$content" > $file
return;
fi
else
echo 'no file'
fi
}
function pushd
{
mypath="/home/app2/dep_sjq/tmp/tmpfj"
current_pid=$$
if [ ! -d "${mypath}" ]
then
mkdir "${mypath}"
fi
parent_id=$(ps -o pid,ppid,comm | grep $current_pid | awk -v current_pid_var=$current_pid '$1==current_pid_var{print $2}')
file="$mypath/${parent_id}.dir"
if [ ! -f "$file" ]
then
touch $file
fi
filecontent=`cat $file`
pwd > $file
echo "$filecontent" >> $file
# sed "1 i ${PWD}" "$file" > $file
oldpath=$PWD
cd $1
echo "$oldpath --> $PWD"
}
C
1
https://gitee.com/hotmocha/minitalk.git
git@gitee.com:hotmocha/minitalk.git
hotmocha
minitalk
minitalk
master

搜索帮助