@@ -299,52 +299,6 @@ if [ -f "$HOME/$ROS_INSTALL_ROOT/activate_ros" ]; then
299299fi
300300mv setenv_gz.sh " $HOME /$ROS_INSTALL_ROOT /activate_ros"
301301
302- # Check if 'ros' alias is set and verify its correctness
303- if alias ros & > /dev/null; then
304- # Get the current alias value
305- CURRENT_ALIAS=$( alias ros | sed -E " s/alias ros='(.*)'/\1/" )
306- EXPECTED_ALIAS=" source $HOME /$ROS_INSTALL_ROOT /activate_ros"
307-
308- if [ " $CURRENT_ALIAS " == " $EXPECTED_ALIAS " ]; then
309- echo -e " \033[32m✅ 'ros' alias is already set correctly.\033[0m"
310- else
311- echo -e " \033[33m⚠️ 'ros' alias is set but points to a different location. Updating it...\033[0m"
312- # Determine the shell configuration file
313- if [ -n " $ZSH_VERSION " ]; then
314- SHELL_RC=" $HOME /.zshrc"
315- elif [ -n " $BASH_VERSION " ]; then
316- SHELL_RC=" $HOME /.bashrc"
317- elif [ -f " $HOME /.zprofile" ]; then
318- SHELL_RC=" $HOME /.zprofile"
319- else
320- echo -e " \033[31m❌ Error: Unsupported shell. Please manually update the alias in your shell configuration file.\033[0m"
321- exit 1
322- fi
323-
324- # Update the alias in the shell configuration file
325- sed -i ' ' " /alias ros=/d" " $SHELL_RC "
326- echo " alias ros='source $HOME /$ROS_INSTALL_ROOT /activate_ros'" >> " $SHELL_RC "
327- echo -e " \033[32m✅ 'ros' alias updated in $SHELL_RC . Please restart your terminal or run 'source $SHELL_RC ' to apply changes.\033[0m"
328- fi
329- else
330- echo -e " \033[33m⚠️ 'ros' alias is not set. Adding it...\033[0m"
331- # Determine the shell configuration file
332- if [ -n " $ZSH_VERSION " ]; then
333- SHELL_RC=" $HOME /.zshrc"
334- elif [ -n " $BASH_VERSION " ]; then
335- SHELL_RC=" $HOME /.bashrc"
336- elif [ -f " $HOME /.zprofile" ]; then
337- SHELL_RC=" $HOME /.zprofile"
338- else
339- echo -e " \033[31m❌ Error: Unsupported shell. Please manually add the alias to your shell configuration file.\033[0m"
340- exit 1
341- fi
342-
343- # Add the alias to the shell configuration file
344- echo " alias ros='source $HOME /$ROS_INSTALL_ROOT /activate_ros'" >> " $SHELL_RC "
345- echo -e " \033[32m✅ 'ros' alias added to $SHELL_RC . Please restart your terminal or run 'source $SHELL_RC ' to apply changes.\033[0m"
346- fi
347-
348302# Print post messages
349303printf ' \033[32m%.0s=\033[0m' {1..75} && echo
350304echo -e " \033[32m🎉 Done. Hurray! 🍎 (Apple Silicon) + 🤖 = 🚀❤️🤩🎉🥳 \033[0m"
@@ -358,7 +312,10 @@ echo -e "\033[31m(IMPORTANT, both terminals should have \033[0m'source $HOME/$VI
358312echo -e " [1st Terminal with ($VIRTUAL_ENV_ROOT )]\033[32m gz sim shapes.sdf -s \033[0m"
359313echo -e " [2nd Terminal with ($VIRTUAL_ENV_ROOT )]\033[32m gz sim -g \033[0m"
360314printf ' \033[32m%.0s=\033[0m' {1..75} && echo
361- echo -e " You can start ROS2 Jazzy - Gazebo Harmonic framework by typing '\033[34mros\033[0m' in the terminal (new terminal)."
315+ echo " To make alias for fast start, run the following command to add to ~/.zprofile:"
316+ echo -e " \033[34mecho 'alias ros=\" source $HOME /$ROS_INSTALL_ROOT /activate_ros\" ' >> ~/.zprofile && source ~/.zprofile\033[0m"
317+ echo
318+ echo -e " Then, you can start ROS2 Jazzy by typing '\033[34mros\033[0m' in the terminal (new terminal)."
362319echo -e " You may change the alias name to your preference in above alias command."
363320echo
364321echo " To deactivate this workspace, run:"
0 commit comments