Search Results

Search: Posts Made By: boqsc
1,730
Posted By boqsc
Executing bash file with sudo for the second time, leads to permission denied, for commands
I have a script that checks if the script has been ran with sudo.
If the script is not ran as sudo, the current script is being executed with exec sudo bash.
You are asked for a password, you type...
1,108
Posted By boqsc
Check my Script and Say what Grinds Your Gears
https://i.imgflip.com/2mn6nl.jpg


This is a script that I, this unix forum and stackoverflow come up with. I would like to get some feedback about it and improve it little bit if possible for...
5,356
Posted By boqsc
Bash programming is a true headache for...
Bash programming is a true headache for beginners. May you suggest any reference book that has this kind of explanations if there is any? Conventions, best practices?
5,356
Posted By boqsc
Added curly braces for better readability, your...
Added curly braces for better readability, your suggestions were very good.



#!/bin/bash

# If we can't run sudo without a password, complain and exit
if ! (sudo -n true 2> /dev/null)
then...
5,356
Posted By boqsc
Yep, that's infinite loop, thanks for pointing...
Yep, that's infinite loop, thanks for pointing that out. That might be the case.


The final version looks like this(only added comments that explains bahaviour):
(Any suggestions to make it...
5,356
Posted By boqsc
The Shell Version ...
The Shell Version

vaidas@SATELLITE-L855:~/Desktop$ $SHELL --version
GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+:...
5,356
Posted By boqsc
Explaining behaviour of sudo bash "$0" "$@";
I've found this script part on the stackoverflow:
if [ $EUID != 0 ]; then
sudo bash "$0" "$@";
exit "$?";
fi


I realized that sudo bash "$0" "$@"; is the only needed for me.


But...
Showing results 1 to 7 of 7

 
All times are GMT -4. The time now is 12:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy