-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
51 lines (43 loc) · 949 Bytes
/
Copy pathsetup.sh
File metadata and controls
51 lines (43 loc) · 949 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
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
HaveDir=false
if [ "${type -t $1}"="alias" ]
then
echo "Name not Vaild, enter a vaild name"
exit 0
fi
if [ -z $2]
then
mkdir ~/devenv
Dir=~/devenv
cd $Dir
git clone https://github.com/DanielRustrum/Linux-Batch-Commands
cp -R Linux-Batch-Commands/* *
rm -r Linux-Batch-Commands
else
HaveDir=true
fi
if [ HaveDir ]
then
cd $2
else
cd $Dir
fi
mkdir Commands
if [ HaveDir ]
then
echo "" >> ~/.bashrc
echo "# My Dev Command" >> ~/.bashrc
echo 'export devCommand() { CWD="$PWD"; cd $2/CLI && ./command.sh "$CWD" "$@"; cd $CWD; }' >> ~/.bashrc
else
echo "" >> ~/.bashrc
echo "# My Dev Command" >> ~/.bashrc
echo 'export devCommand() { CWD="$PWD"; cd $Dir/CLI && ./command.sh "$CWD" "$@"; cd $CWD; }' >> ~/.bashrc
fi
if [ -z $1 ]
then
echo "alias mydev='devCommand" >> ~/.bashrc
else
echo "alias $1='devCommand" >> ~/.bashrc
fi
echo "Everything is ready!"
cd ~