cs50 / libcs50

This is CS50's Library for C.
https://cs50.readthedocs.io/libraries/cs50/c/
GNU General Public License v3.0
1.71k stars 844 forks source link

Pull Request to add CS50 LIBS in a GNU/Linux Box through a BashScript #254

Open OrionRandD opened 2 years ago

OrionRandD commented 2 years ago

hash!/usr/bin/env bash hash replace the word "harsh" to its actual symbol in this script hash Installing CS50 C and Python LIBS in a Linux Box hash Arquivo cs50-c_pyt_LIBS.sh no diretório ~/bin hash Uncommnet the following lines if you want hash to run this script in "X", or not, and make the adjustments hash to fit your taste... hash if ! [[ -v DISPLAY ]] hash test if it is not in Xwindow hash then hash echo "You are not on X :p" hash else hash echo "You are on X :)" hash fi

hash Uncomment the following lines - from "if" to "fi" hash if you want to write a script to run as sudo/root hash Testa se o usuário é root ou normal. O usuário root tem o UID=0 if [[ $UID -ne 0 ]]; then printf "Non root user :p\n\nPlease run as root or sudo...\n\n" exit 1 else echo "Root user" fi

hash CS50-Harvard libraries for GNU/Linux hash requirements for Python

cd /tmp sudo -H pip install cs50 submit50 style50 check50

hash requirements for C

git clone https://github.com/cs50/libcs50 cd libcs50 sudo make install sudo ldconfig

hash Note: hash A regular sudo pip install flake8 hash will try to use your own home directory. hash The -H instructs it to use the system's home directory. hash More info at https://stackoverflow.com/a/43623102/

MrConorAE commented 2 years ago
#!/usr/bin/env bash
# replace the word "harsh" to its actual symbol in this script
# Installing CS50 C and Python LIBS in a Linux Box
# Arquivo cs50-c_pyt_LIBS.sh no diretório ~/bin
# Uncommnet the following lines if you want
# to run this script in "X", or not, and make the adjustments
# to fit your taste...

if ! [[ -v DISPLAY ]] hash 
# test if it is not in Xwindow
then
echo "You are not on X :p"
else
echo "You are on X :)"
fi

# Uncomment the following lines - from "if" to "fi"
# if you want to write a script to run as sudo/root
# Testa se o usuário é root ou normal. O usuário root tem o UID=0
if [[ $UID -ne 0 ]];
then printf "Non root user :p\n\nPlease run as root or sudo...\n\n"
exit 1
else
echo "Root user"
fi

# CS50-Harvard libraries for GNU/Linux
# requirements for Python

cd /tmp
sudo -H pip install cs50 submit50 style50 check50

# requirements for C

git clone https://github.com/cs50/libcs50
cd libcs50
sudo make install
sudo ldconfig

# Note:
# A regular sudo pip install flake8
# will try to use your own home directory.
# The -H instructs it to use the system's home directory.
# More info at https://stackoverflow.com/a/43623102/

formatted it for you :)

OrionRandD commented 2 years ago
#!/usr/bin/env bash
# replace the word "harsh" to its actual symbol in this script
# Installing CS50 C and Python LIBS in a Linux Box
# Arquivo cs50-c_pyt_LIBS.sh no diretório ~/bin
# Uncommnet the following lines if you want
# to run this script in "X", or not, and make the adjustments
# to fit your taste...

# if ! [[ -v DISPLAY ]] hash test if it is not in Xwindow
# then
# echo "You are not on X :p"
# else
# echo "You are on X :)"
# fi

# Uncomment the following lines - from "if" to "fi"
# if you want to write a script to run as sudo/root
# Testa se o usuário é root ou normal. O usuário root tem o UID=0
if [[ $UID -ne 0 ]];
then printf "Non root user :p\n\nPlease run as root or sudo...\n\n"
exit 1
else
echo "Root user"
fi

# CS50-Harvard libraries for GNU/Linux
# requirements for Python

cd /tmp
sudo -H pip install cs50 submit50 style50 check50

# requirements for C

git clone https://github.com/cs50/libcs50
cd libcs50
sudo make install
sudo ldconfig

# Note:
# A regular sudo pip install flake8
# will try to use your own home directory.
# The -H instructs it to use the system's home directory.
# More info at https://stackoverflow.com/a/43623102/

formatted it for you :)

Thx, I did not write the hash symbols because I thought github would mess with it because of .md format...

Here is an example of it working on Linux in Emacs... https://mark.nl.tab.digital/s/b9fK9zRYYw4kLpw

goyalyashpal commented 2 years ago

@OrionRandD hi, thanks for this, you dont need to quote whole of previous comment though. this makes it hard to follow the issues. cheers (:

# if ! [[ -v DISPLAY ]] hash test if it is not in Xwindow

@MrConorAE one hash is left there ;) fix that as well. lots of thanks to you, i was not able to follow the script otherwise.

# if ! [[ -v DISPLAY ]]         # test if it is not in Xwindow

or

# test if it is not in Xwindow
# if ! [[ -v DISPLAY ]]