-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfcd.sh
More file actions
executable file
·31 lines (28 loc) · 781 Bytes
/
Copy pathfcd.sh
File metadata and controls
executable file
·31 lines (28 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# Copyright (C) Torbjorn Hedqvist - All Rights Reserved
# You may use, distribute and modify this code under the
# terms of the MIT license. See LICENSE file in the project
# root for full license information.
#
# This script works in conjunction with fcd.py
# If fcd.py creates the files below it will
# a) change directory to the content of ~/.fcd_dir and
# b) execute the commands in ~/.fcd_cmd
#
fcd.py $@
retVal=$?
if [ $retVal -ne 0 ]; then
# fcd.py have exited abnormally
echo "Aborting"
return $retVal
fi
# Created on succesful call to fcd.py
if [ -e ~/.fcd_dir ]; then
fcd_dir=$(<~/.fcd_dir)
cd "$fcd_dir"
fi
# Created if previous call to fcd.py had an attached extra command line
if [ -e ~/.fcd_cmd ]; then
source ~/.fcd_cmd
fi