β² 456 βΌ Rule (thelemmy.club) submitted 2 days ago by Lisk91@sh.itjust.works to c/linuxmemes@lemmy.world 128 comments fedilink hide all child comments
[β] electric_nan@lemmy.ml 1 point 2 days ago (1 child) I don't get it. Looks like a script that runs all these things, but I don't get the one dollar. permalink fedilink source parent hideshow 2 child comments replies: [β] FlexibleToast@lemmy.world 6 points 2 days ago (1 child) The $1 is a positional variable. So if you run ./script.sh arg1 $1 would be arg1 in that example, $0 would be the ./script.sh. It's the simplest way to pass an argument to a script. permalink fedilink source parent hideshow 2 child comments replies: [β] electric_nan@lemmy.ml 1 point 2 days ago (2 children) So... huh? What role does this play, since all the lines in the picture have $1? If you run it with arg1, won't it run them all? And if you left out arg1 and also didn't add $1 to each line, wouldn't it also just run all of them? permalink fedilink source parent hideshow 4 child comments replies: [β] captain_aggravated@sh.itjust.works 7 points 2 days ago (1 child) So the joke is, you've got something you want to install, be it a Python module, Java library, steam game, desktop application, whatever. You want it installed, figuring out which package manager has it and remembering the exact command syntax starts getting to be a pain, so just use this script to try installing it from a variety of sources. You would evoke it by running ./install.sh package and it will replace all instances of $1 with the string "package" at runtime. The ampersand at the end of each line will run that line as a separate background process rather than in the foreground process, so effectively this will attempt to install "package" or whatever you put in as an argument from a half dozen sources simultaneously in parallel. These include the old and new Python package managers, the old and new Red Hat package managers, debian/Ubuntu's APT with and without sudo, cloning a git repo and building from source, and the icing on the cake is curling directly into bash. Don't curl directly into bash. You'll catch genital rabies. Remember that this is an XKCD comic, it's a joke. The alt-text says "The failures usually don't hurt anything and if it installs multiple versions it increases the chance one of them is right. (the 'yes' command and '2>/dev/null' are recommended additions.)" "Yes" is a bash command that will spam 'y' in the terminal, the point of it is to answer yes to any questions an automated system asks, and 2>/dev/null will stop it from displaying errors. These add an even deeper level of Yolo-ing. permalink fedilink source parent hideshow 2 child comments replies: [β] electric_nan@lemmy.ml 3 points 2 days ago Ah alright. Pretty sure I get it now. Thank you for explaining! permalink fedilink source parent [β] ABasilPlant@lemmy.world 6 points 2 days ago If you run it with arg1, won't it run them all? Yes, that is the intention. When you're following some guide online and it requires you use some "software", you may not know how to install that software. This install.sh script tries package managers, because one of them will probably work. Others will fail. For example, installing numpy (python package): pip install succeeds and all the other ones (hopefully) fail. Installing libcurl4-openssl-dev (curl with openssl library file): apt-get install works and all other ones (hopefully) fails. Longer and more thorough explanation: https://www.explainxkcd.com/wiki/index.php/1654:_Universal_Install_Script permalink fedilink source parent
[β] FlexibleToast@lemmy.world 6 points 2 days ago (1 child) The $1 is a positional variable. So if you run ./script.sh arg1 $1 would be arg1 in that example, $0 would be the ./script.sh. It's the simplest way to pass an argument to a script. permalink fedilink source parent hideshow 2 child comments replies: [β] electric_nan@lemmy.ml 1 point 2 days ago (2 children) So... huh? What role does this play, since all the lines in the picture have $1? If you run it with arg1, won't it run them all? And if you left out arg1 and also didn't add $1 to each line, wouldn't it also just run all of them? permalink fedilink source parent hideshow 4 child comments replies: [β] captain_aggravated@sh.itjust.works 7 points 2 days ago (1 child) So the joke is, you've got something you want to install, be it a Python module, Java library, steam game, desktop application, whatever. You want it installed, figuring out which package manager has it and remembering the exact command syntax starts getting to be a pain, so just use this script to try installing it from a variety of sources. You would evoke it by running ./install.sh package and it will replace all instances of $1 with the string "package" at runtime. The ampersand at the end of each line will run that line as a separate background process rather than in the foreground process, so effectively this will attempt to install "package" or whatever you put in as an argument from a half dozen sources simultaneously in parallel. These include the old and new Python package managers, the old and new Red Hat package managers, debian/Ubuntu's APT with and without sudo, cloning a git repo and building from source, and the icing on the cake is curling directly into bash. Don't curl directly into bash. You'll catch genital rabies. Remember that this is an XKCD comic, it's a joke. The alt-text says "The failures usually don't hurt anything and if it installs multiple versions it increases the chance one of them is right. (the 'yes' command and '2>/dev/null' are recommended additions.)" "Yes" is a bash command that will spam 'y' in the terminal, the point of it is to answer yes to any questions an automated system asks, and 2>/dev/null will stop it from displaying errors. These add an even deeper level of Yolo-ing. permalink fedilink source parent hideshow 2 child comments replies: [β] electric_nan@lemmy.ml 3 points 2 days ago Ah alright. Pretty sure I get it now. Thank you for explaining! permalink fedilink source parent [β] ABasilPlant@lemmy.world 6 points 2 days ago If you run it with arg1, won't it run them all? Yes, that is the intention. When you're following some guide online and it requires you use some "software", you may not know how to install that software. This install.sh script tries package managers, because one of them will probably work. Others will fail. For example, installing numpy (python package): pip install succeeds and all the other ones (hopefully) fail. Installing libcurl4-openssl-dev (curl with openssl library file): apt-get install works and all other ones (hopefully) fails. Longer and more thorough explanation: https://www.explainxkcd.com/wiki/index.php/1654:_Universal_Install_Script permalink fedilink source parent
[β] electric_nan@lemmy.ml 1 point 2 days ago (2 children) So... huh? What role does this play, since all the lines in the picture have $1? If you run it with arg1, won't it run them all? And if you left out arg1 and also didn't add $1 to each line, wouldn't it also just run all of them? permalink fedilink source parent hideshow 4 child comments replies: [β] captain_aggravated@sh.itjust.works 7 points 2 days ago (1 child) So the joke is, you've got something you want to install, be it a Python module, Java library, steam game, desktop application, whatever. You want it installed, figuring out which package manager has it and remembering the exact command syntax starts getting to be a pain, so just use this script to try installing it from a variety of sources. You would evoke it by running ./install.sh package and it will replace all instances of $1 with the string "package" at runtime. The ampersand at the end of each line will run that line as a separate background process rather than in the foreground process, so effectively this will attempt to install "package" or whatever you put in as an argument from a half dozen sources simultaneously in parallel. These include the old and new Python package managers, the old and new Red Hat package managers, debian/Ubuntu's APT with and without sudo, cloning a git repo and building from source, and the icing on the cake is curling directly into bash. Don't curl directly into bash. You'll catch genital rabies. Remember that this is an XKCD comic, it's a joke. The alt-text says "The failures usually don't hurt anything and if it installs multiple versions it increases the chance one of them is right. (the 'yes' command and '2>/dev/null' are recommended additions.)" "Yes" is a bash command that will spam 'y' in the terminal, the point of it is to answer yes to any questions an automated system asks, and 2>/dev/null will stop it from displaying errors. These add an even deeper level of Yolo-ing. permalink fedilink source parent hideshow 2 child comments replies: [β] electric_nan@lemmy.ml 3 points 2 days ago Ah alright. Pretty sure I get it now. Thank you for explaining! permalink fedilink source parent [β] ABasilPlant@lemmy.world 6 points 2 days ago If you run it with arg1, won't it run them all? Yes, that is the intention. When you're following some guide online and it requires you use some "software", you may not know how to install that software. This install.sh script tries package managers, because one of them will probably work. Others will fail. For example, installing numpy (python package): pip install succeeds and all the other ones (hopefully) fail. Installing libcurl4-openssl-dev (curl with openssl library file): apt-get install works and all other ones (hopefully) fails. Longer and more thorough explanation: https://www.explainxkcd.com/wiki/index.php/1654:_Universal_Install_Script permalink fedilink source parent
[β] captain_aggravated@sh.itjust.works 7 points 2 days ago (1 child) So the joke is, you've got something you want to install, be it a Python module, Java library, steam game, desktop application, whatever. You want it installed, figuring out which package manager has it and remembering the exact command syntax starts getting to be a pain, so just use this script to try installing it from a variety of sources. You would evoke it by running ./install.sh package and it will replace all instances of $1 with the string "package" at runtime. The ampersand at the end of each line will run that line as a separate background process rather than in the foreground process, so effectively this will attempt to install "package" or whatever you put in as an argument from a half dozen sources simultaneously in parallel. These include the old and new Python package managers, the old and new Red Hat package managers, debian/Ubuntu's APT with and without sudo, cloning a git repo and building from source, and the icing on the cake is curling directly into bash. Don't curl directly into bash. You'll catch genital rabies. Remember that this is an XKCD comic, it's a joke. The alt-text says "The failures usually don't hurt anything and if it installs multiple versions it increases the chance one of them is right. (the 'yes' command and '2>/dev/null' are recommended additions.)" "Yes" is a bash command that will spam 'y' in the terminal, the point of it is to answer yes to any questions an automated system asks, and 2>/dev/null will stop it from displaying errors. These add an even deeper level of Yolo-ing. permalink fedilink source parent hideshow 2 child comments replies: [β] electric_nan@lemmy.ml 3 points 2 days ago Ah alright. Pretty sure I get it now. Thank you for explaining! permalink fedilink source parent
[β] electric_nan@lemmy.ml 3 points 2 days ago Ah alright. Pretty sure I get it now. Thank you for explaining! permalink fedilink source parent
[β] ABasilPlant@lemmy.world 6 points 2 days ago If you run it with arg1, won't it run them all? Yes, that is the intention. When you're following some guide online and it requires you use some "software", you may not know how to install that software. This install.sh script tries package managers, because one of them will probably work. Others will fail. For example, installing numpy (python package): pip install succeeds and all the other ones (hopefully) fail. Installing libcurl4-openssl-dev (curl with openssl library file): apt-get install works and all other ones (hopefully) fails. Longer and more thorough explanation: https://www.explainxkcd.com/wiki/index.php/1654:_Universal_Install_Script permalink fedilink source parent