-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnff
More file actions
executable file
·41 lines (33 loc) · 911 Bytes
/
nff
File metadata and controls
executable file
·41 lines (33 loc) · 911 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
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
cd $HOME
# list of all the parent
list=(
$(ls -d -- Developer/*)
"[new]"
)
# selected string
selected=$(echo ${list[@]} | tr " " "\n" | fzf --header "select Parent Directory[new/any]" --prompt='▶' --pointer='→')
if test -z $selected; then
echo "Select any Parent directory or [new] to create new parent\nexiting....";
exit 1;
fi
if test ! -z $selected && test $selected = "[new]"; then
# change the cwd to root "Developer"
cd Developer || exit 1
read -p "Enter parent & directory name(parent/dir): " dir
mkdir -p "$dir" || exit 1
dir="Developer/$dir"
else
# change the cwd to selected
cd "$selected" || exit 1
read -p "Enter directory name: " dir
mkdir "$dir" || exit 1
dir="$selected/$dir"
fi
echo "$dir"
cd $HOME
if tmux list-sessions | grep -qs $dir; then
tmux switchc -t "$dir"
else
tmux new-session -c $(pwd)/$dir -s "$dir" -d && tmux switchc -t $dir
fi