Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
OrionRandD opened this issue Dec 12, 2021 · 3 comments
Open

Comments

@OrionRandD
Copy link

OrionRandD commented Dec 12, 2021

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/

@OrionRandD OrionRandD changed the title pull request to add a GNU/Linux script to install CS50 on a Linux box pull request to add CS50 LIBS in a GNU/Linux Box through a bashscript Dec 12, 2021
@OrionRandD OrionRandD changed the title pull request to add CS50 LIBS in a GNU/Linux Box through a bashscript Pull Request to add CS50 LIBS in a GNU/Linux Box through a BashScript Dec 12, 2021
@MrConorAE
Copy link

MrConorAE commented Dec 12, 2021

#!/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
Copy link
Author

OrionRandD commented Dec 13, 2021

#!/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
Copy link

goyalyashpal commented Jan 1, 2022

@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 ]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants