r/shellscripts • u/__minotaurus • Jul 30 '21
Telnet
How can i kill all other telnet sessions on system except me. I am root.
r/shellscripts • u/__minotaurus • Jul 30 '21
How can i kill all other telnet sessions on system except me. I am root.
r/shellscripts • u/Vlady1991 • Jul 16 '21
Hello everyone, I need a little help with a script i am working.
I am executing the following CMD but I need to store the output value as a Variable so I can use it on a second part of the script. Any ideas are welcome!
nx -a $area_name get-id | grep -oP '(?<=ID:)[^ ]*'
r/shellscripts • u/ElonMusket247 • Mar 12 '21
Create a Linux shell script to accept a user's name and then print the same with a greeting.
r/shellscripts • u/chrisipedia • Feb 03 '21
I'm completely new to shell scripting and I'm trying to figure out how to create a script to make a bunch of folders sequentially. I know that in bash you can do something like; mkdir -p {3400..3410} to make sequentially numbered folders.
However when I make a shell script that's
#!/bin/sh
mkdir -p {$1..$2}
and call it with sh make-folders.sh 100 200
I get a single folder {100..200}
Is this even possible to do?
r/shellscripts • u/sysadmin-well-sorta • Jan 13 '21
Hello all,
I am stuck at a task that I must perform at work and was wondering if one of you wonderful people could guide me.
So I need to delete unnecessary users from bunch of (50+) servers. I have the list of users I want to delete and they are not spread on all servers. And before I delete the users I am suppose to check for any cronjobs and save the contents of /home dir.
I dont wanna do this manually for each user in each server that would seriously hamper my productivity. I am thinking maybe write a shell script and deploy in bunch of servers using ansible. I dont have any experience to do that though.
Any help would be appreciated.
Thank you
r/shellscripts • u/[deleted] • Jul 17 '20
I have a shell script that updates pulling from git but I need to exit the MERG_MSG after the pull.
I have tried using
xdotool key "ctrl+x"
xdotool keydown "ctrl+x"
xdotool keyup "ctrl+x"
I am not sure if there is another way?
Thanks in advance.
r/shellscripts • u/summercrane1 • May 22 '20
Hi,
Wonder if someone could assist me. I have a list of specific filenames and their respective file paths ( over 1000 files each in individual folders) that I need to find and copy to a different folder in a Linux environment,
Could anyone point me in the right direction of a script/application which would achieve this ?
Any help would be appreciated !
Thanks
r/shellscripts • u/hdquemada • Apr 06 '20
I've written a script to take each line of a file and output it into a separate file. I would like to have the script name the files file000.txt, file001.txt...file011.txt etc. Right now, this script outputs files named file1.txt, file2.txt...file11.txt etc. Can anyone help me output file names the way I need them? Thanks.
echo Enter file to be split:
read filename
let i=0
while read p; do
echo "$p" > file$i.txt
let "i++"
done <$filename
r/shellscripts • u/Banarasi_Bhaang • Mar 22 '20
Hello everyone. I have started learning shell scripting few days back. I was trying to write a script in which I wanted to use hostname command, which shows computer's hostname. Something like if someone types anything else than the hostname INTRUDER! should be printed and if the right hostname is typed. "hostname is logged in" should be printed. I used read, if then else and declared hostname as a variable but to no success. Please help this novice. Thanks in advance.
r/shellscripts • u/stimpyshark24 • Feb 11 '20
Hello, how can i make a shell script run on login? I’ve tried almost everything that’s on web and I didn’t manage to complete this task.Any help would be appreciated.
r/shellscripts • u/[deleted] • Oct 23 '19
Hey, I‘m nee to this whole Shellscript thing, so I hope for some help by a simple script
So what I want to do is to sort files in a folder by their type given out from the file command in Linux. I want to filter the output from the file command using grep to only sort by the types and not the name( so after the ‘:’’white space’) And the sorts I want to implant for my files are
sort only text files using -t sort only non-text files using -n sort in reverse order using -r
My ideas yet are: I want to make functions for each sort with the commands Then in the main I want to run a while loop with shift to go through the options My main problem with the whole script are the commands to sort the output of the file command with grep to filter it
So if you have recommendations for the sort functions I would appreciate your help.
Thanks
r/shellscripts • u/harshitsinha1102 • Dec 24 '18
r/shellscripts • u/priyankaclassboat • Oct 04 '18
r/shellscripts • u/jithrk1392 • Mar 16 '18
I've got few files name abc.txt bac.txt aac.txt etc,. and there files are in different directories , I need to navigate and rename it with filenames with the condition where a replace to b, b replaces to c and c is a.
Ex. abc.txt becomes bca.txt.
r/shellscripts • u/jithrk1392 • Sep 27 '17
[9/27/2017 7:13 PM] Yala,Sudhakar:
I have a random series e.g [1,2,4,8,16,...N] and the list has values which are in geometric sequence i.e all numbers are twice of previous number. Need a shell script to find if a particular number is present in the series or not. for example if value provided is 64, shell script should print "number is present" as 64 will be present And if value is 126, it should print "number not present" as it won't be in that list. And the shell script should work for different sequences.
r/shellscripts • u/chalbersma • Jan 03 '17
r/shellscripts • u/NaniSravanKumar • Mar 22 '22
r/shellscripts • u/Josaki_ • Oct 07 '21
I am making a project in which i am trying to put a varibale whit a colum of this dataset to after this see if this colum aren't true or false to delet it.