Bash Script Help!

I need this script refined so that if $j already exists in the file it does not echo the two start/stop entries.


SMATCH=`echo $SUDO_USER | cut -d@ -f2`;

if [ "$SMATCH" != "[login to view URL]" ] ;then {

S_USER="$SUDO_USER@[login to view URL]"


else {




for i in $( ls -1A /home/$S_USER/*.service); do

j=$(basename $i)

chmod 755 /home/$S_USER/$j

chown root:root /home/$S_USER/$j

mv /home/$S_USER/$j /etc/systemd/system/

systemctl enable $j

systemctl daemon-reload

k=$(cat /etc/sudoers.d/DEV | head -1 | awk '{print $1}');

j=$(echo $j| cut -d. -f1);

echo "" >> /etc/sudoers.d/DEV

echo "$k ALL=PASSWD: /bin/systemctl start $j" >> /etc/sudoers.d/DEV

echo "$k ALL=PASSWD: /bin/systemctl stop $j" >> /etc/sudoers.d/DEV


Taidot: Linux, Shell Script, tietojärjestelmäarkkitehtuuri, Järjestelmänvalvoja, UNIX

Näytä lisää: flash script help service, help i need a coder today, help i need a dropbox consultant, bash script example, bash help, bash script options, bash script check user, bash script arguments, bash script check usage, bash script with arguments and help, bash getopts, help i need a manager, help i need an arduino programmer, help i need bloggers, i have an existing php/mysql script that i need customized with additional functions, i have an existing phpmysql script that i need customized with additional functions, i need an android app i already have a design for it i just need it to be built gps service for taxi, help i need a research topic, i am a learner in grade 11 i need help i am worried about my future i want to become a lawyer how can i get a bursary in kzn, as i rosina need help to write avidavite

Tietoa työnantajasta:
( 20 arvostelua ) Franklin, United States

Projektin tunnus: #18759655

Myönnetty käyttäjälle:


Hi, Do you mean , $j exist in /home/$S_user/*.service directory ? Or you mean $j exist in the sudoers file? Yes, you can do that and its a simple check. Thanks

$12 USD 1 päivässä
(26 Arvostelua)

15 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön


I can do the fix with a grep check on the file. Will be done in 5 minutes. Thank you ...............

$15 USD 1 päivässä
(307 arvostelua)

Hey there, I'm a System Engineer with coding skills. I had developed tons of Bash scripts. Do you mean $j in the name of the file or in the content of the file?

$30 USD 1 päivässä
(38 arvostelua)

G'day, I'm an experienced and talented Linux DevOps engineer. Bash scripting is my bread and butter, I have complete confidence in my ability to help you resolve your issue with your sudoers generation script.

$30 USD 1 päivässä
(4 arvostelua)

Hi, I can help you changed bash script. I'm ready to start working right now. My experience in the administration of the Linux system and web-dev (PHP, MYSQL, POSTGRESQL, CakePHP, HTML, JS, ETC.) is more than 8 years Lisää

$25 USD 1 päivässä
(26 arvostelua)

Greeting!. Yours work is one of the tasks that can be done very perfectly by us. We work within your budget, Within your deadline. We are highly experienced Post Graduate Engineers, IT, ITES, Software, Infrastructure P Lisää

$10 USD 1 päivässä
(24 arvostelua)

Hello, I'm an expert in Linux (18 years of experience; Debian, Ubuntu, CentOS and many others), bash/shell scripting, etc. Please look at my profile for my previous bash/shell projects.

$30 USD 1 päivässä
(21 arvostelua)

Good day, I may be able to help you with this problems of your if you ever do so consider my help. Thanks...

$25 USD 1 päivässä
(10 arvostelua)

Hi, I am very happy to bid your project. I read your requirements carefully,so i see what you mean. I have been experiments with Linux, Shell Script, Software Architecture, System Admin, UNIX,Php. I'd like to work Lisää

$30 USD 1 päivässä
(7 arvostelua)

Hello, I can have your script in 24H You can check my profile, and worked before with Bash Scripting I can check this on RHEL7, Centos, Debian Ubuntu Server or any other distribution based on Linux kerne Lisää

$15 USD 1 päivässä
(2 arvostelua)

Hi I am Kamal Mehta. I have 12 Years of experience in Shell Scripting. Please contact me to discuss more details. I also wanted to see any sample output of your existing script where you can clearly show me which line Lisää

$35 USD 1 päivässä
(2 arvostelua)
$25 USD 1 päivässä
(0 arvostelua)

Tell me what the requirement exactly is, i think the shell script is written in a very complicated way and I am sure there are systems functions to do the same. I can rewrite the script with a better logic for the bid Lisää

$35 USD 1 päivässä
(0 arvostelua)

Hi i am Kamlesh, software developer. I have 8 year of experience in shell scripts. i have completed multiple projects on shell scripts. i can complete this on time.

$15 USD 1 päivässä
(0 arvostelua)

Hello, An if statement with an inverted grep match on the variable can help you achieve this. It would be better to check for "start $j" and "stop $j" and adding only the one missing. A check on the $j variable onl Lisää

$15 USD 1 päivässä
(0 arvostelua)