-
Notifications
You must be signed in to change notification settings - Fork 0
/
permission.sh
41 lines (35 loc) · 1.23 KB
/
permission.sh
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/bash
# Get the current directory path
current_path=$(pwd)
# Change directory to the parent directory of the folders containing the Python files
cd "$current_path"
# Build work space
catkin_make
sudo find . -name "*.py" -type f -exec chmod 777 {} \;
# Change permissions of all Python files in subdirectories
SHELL_TYPE="$(basename "$SHELL")"
echo "--------------------"
echo "Shell Type : $SHELL_TYPE"
if [ "$SHELL_TYPE" == "bash" ]; then
# Bash shell
if ! grep -q "source $current_path/devel/setup.bash" ~/.zshrc; then
echo "source $current_path/devel/setup.bash" >> ~/.bashrc
echo "Added 'source $current_path/devel/setup.bash' to ~/.bashrc"
else
echo "'source $current_path/devel/setup.bash' is already created in the bashrc file."
fi
elif [ "$SHELL_TYPE" == "zsh" ]; then
# Zsh shell
if ! grep -q "source $current_path/devel/setup.zsh" ~/.zshrc; then
echo "source $current_path/devel/setup.zsh" >> ~/.zshrc
echo "Added 'source $current_path/devel/setup.zsh' to ~/.zshrc"
else
echo "'source $current_path/devel/setup.zsh' is already created in the zshrc file."
fi
else
echo "Unsupported shell type: $SHELL_TYPE"
exit 1
fi
# Setup Completed
echo "Setup completed."
echo "--------------------"