You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One very convenient improvement that could be made to the setup scripts for both the Jetson Nano and the PC development environments is to make them reusable. Currently, each setup script should only be run once on their target platform. While there are multiple things that would need to be done to make everything reusable in the scripts, the first thing is to deal with the following problem caused by adding code to a user's .bashrc:
echo"export CUDA_HOME=/usr/local/cuda">>~/.bashrc
This command appends export CUDA_HOME=/usr/local/cuda to the end end of the user's .bashrc. If the script is run multiple times then this line in the setup script will add another copy of the command to the end of the .bashrc script. Therefore we wish to check if the command already exists and if it does we should remove the old version and place append the new version.
To implement this feature, it would be best to create a bash function with parameters so that the code can be reused. An example implementation is outlined below:
INPUT: command, replace_flag, replace_pattern
IF replace_flag is true and replace_pattern is in .bashrc:
replace line that contains replace_pattern with command
exit function
ENDIF
append command to end of .bashrc
sed is a command that allows you to perform basic text transformations using regular expressions. Google tutorials to learn about it or stack overflow will have code for your specific operation.
The text was updated successfully, but these errors were encountered:
One very convenient improvement that could be made to the setup scripts for both the Jetson Nano and the PC development environments is to make them reusable. Currently, each setup script should only be run once on their target platform. While there are multiple things that would need to be done to make everything reusable in the scripts, the first thing is to deal with the following problem caused by adding code to a user's
.bashrc
:This command appends
export CUDA_HOME=/usr/local/cuda
to the end end of the user's.bashrc
. If the script is run multiple times then this line in the setup script will add another copy of the command to the end of the.bashrc
script. Therefore we wish to check if the command already exists and if it does we should remove the old version and place append the new version.To implement this feature, it would be best to create a bash function with parameters so that the code can be reused. An example implementation is outlined below:
sed
is a command that allows you to perform basic text transformations using regular expressions. Google tutorials to learn about it or stack overflow will have code for your specific operation.The text was updated successfully, but these errors were encountered: