A shell script is a script written for the shell, or command line interpreter, of an operating system.

learn more…| top users | synonyms (1)

-1
votes
0answers
11 views

Output the contents of all files modified after a given timestamp [on hold]

I want to output the contents of all of the files in a directory hierarchy that have been modified since a given timestamp. The order of output of the files is not important. I will take this output ...
-1
votes
2answers
29 views

bash + how to capture the requated field from variable

we set the variable with the follwing valuesMY_VAR=" one two three four"how to capture the first value from variable with bash? ( without using echo command ) expected output one
1
vote
1answer
19 views

how to use xmllint in order to get value from xml

I have the following XML file<?xml version="1.0" encoding="UTF-8" ?><!-- Component configuration file --><Component><Name>install_env</Name><HelpString>...
1
vote
1answer
59 views

bash + how to avoid specific messages in the log file

when I run the bash script on my Linux machine we get the following errors in my log , note - we set in the script:exec > $log 2>&1 , ( in order to send all standard error/output to $...
3
votes
1answer
27 views

How to use shell in ConEmu console for windows 10 when I enabled shell in developer mode?

I enabled the shell with this tutorial https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10But if I have a shell script named ca.sh in a project root directory, I still can'...
1
vote
1answer
15 views

How can I modify this inotifywait script to upload any file from any directory?

How can I modify this inotifywait script to upload any file from any directory?I am working on an inotifywait based script which should check for file creation and changes recursively in a directory ...
-1
votes
0answers
34 views

How can I keep all logs from Samba?

I'm using FreeBSD, and Samba only keeps current + previous log (which it overwrites). Inevitably the log entry I want is gone by the time I find I need it. I've increased log size a lot but it's not ...
0
votes
0answers
21 views

Activate virtualenv using alias

I can activate my python virtual environment from it's folder by entering . bin/activate. I'd like to instead type a single word alias, such as shazam, from the home folder (or anywhere else) that ...
1
vote
1answer
103 views

How to batch create folder with same name as file and move file into folder?

I tried the method here, but it failed.I have test files and folders in ~/Desktop/z named n copy, n copy 2, and untitled folder.I cd'd to z, ran the command, then this was the output:How can ...
0
votes
1answer
17 views

Does set timeout change each expect statement, or just the final expect eof?

I'm learning to use /usr/bin/expect for the first time, to automate the nightmare that is installing fink from source, as that script has a few dozen prompts, all of which can be answered with the ...
0
votes
1answer
63 views

Shell Script email output formatting

I am trying to create a shell script that echo's a bunch of commands and have gotten it to send out emails fairly simply. {echo $(hostname)echo ""echo "Uptime" $(uptime)echo ""echo "...
1
vote
1answer
85 views

Manage space between words (.bat)

The question might not be so good to ask, but I am really not getting a workaround for same. I have a .bat file which connects UNIX (using PuTTY command line plink) server and further executes a .sh ...
0
votes
1answer
28 views

Can cron “cache” scripts it runs?

Caveats up front:1. My *nix knowledge is very limited but growing.2. This particular issue applies to SunOS 5.10 (I know) but I'd be interested in general answers.If a cron entry runs script ...
0
votes
1answer
26 views

Delayed execution on shell script

I made a simple script file on my linux machine to mount a iscsi drive.iscsiadm –m node --targetname THE_TARGET_IQN --loginmount /dev/sdb1 /home/mountedThe problem is, When I exceuted this script,...
3
votes
1answer
49 views

Looking for a way to notify a user if they have been disconnected from the internet for long periods of time

as the title says I am looking for a good way to send a notification to a windows user if the machine has been disconnected from the internet for long periods of time (14+ days).These are industrial ...
0
votes
2answers
37 views

File process print last 2 character of first columns and rest

I have input file having 11 columns and this files need to process, output first columns last 2 digits and print rest of columns. Fields are comma separated. I have tried some commands but not get ...
0
votes
0answers
41 views

Shell script monitoring files in folder

I made this script below #Monitoring the Inbound folderdirectory="/mount/data/PeppolICSInORG/$(date +"%Y-%m-%d")" number_of_files=$(ls -A $directory | wc -l)if [ "$number_of_files"=="0" ]; ...
0
votes
0answers
26 views

Unix - Automated MD5SUM Verification / Security reccommendations

This is my first post on here so go easy on me!I am currently looking into ways of securing a number of E-Commerce websites which serve a large amount of tragic each day. So far we have ...
1
vote
1answer
67 views

Getting AWK error while transpose some message content

I trying to transpose below text into single line with pipe separated, i getting some error if text is start with number% , what is the issue, any other command is there Sample content in txt file...
0
votes
0answers
41 views

Bandwidth throttling by executing custom script in router

Is there a way to imitate data fluctuations in mobile networks, like fluctuating between LTE, 3G and 2G, randomly or on a timed, via script using a router. I'm trying to study my apps performance in ...
1
vote
1answer
42 views

Parsing errors due to special characters in dns txt records

I have trouble parsing dns txt records retrieved by a script I wrote. The script takes a records, ns records and txt records and writes them to a .csv file. I am using semicolon to separate entries ...
0
votes
1answer
31 views

How to iterate through directory and move particular files to a different folder [closed]

I have a directory setup as follows:/A001/A001_C001/A001_C001.mov/A001/A001_C002/A001_C002.mov--/A002/A002_C001/A002_C001.mov/A002/A002_C002/A002_C002.mov--..etc.I need to write a script ...
-2
votes
3answers
33 views

how to compare 2 list of files with same filesnames except extension a remove only matches shell script

for each file .ext1 i generate a second file .ext2 with same filename except for extension, and then i remove all .ext1 files. The process can sometimes fail, so i would like no know how to remove ...
1
vote
1answer
43 views

ssh - looking up IP through API on-demand

Is there a way to make ssh dynamically lookup the ip address for a given hostname through an external API?The scenario is that I have a few customers with thousands of varying on-demand cloud ...
0
votes
1answer
13 views

Shell Script Will Not Work After File Transfer to Server But Will Work If Copied in VI

As the title states, I have a shell script written then transfer the file to RHEL6 or 7. I give the script executable permission and run. It outputs a bunch of errors. If I vi backup.sh, copy ...
0
votes
1answer
103 views

Check directory exists on remote server

I am trying to check if directory exists on remote server using sshpass command with ssh. This is my codeif [sshpass -p 'xxxx' ssh admin@xx.xx.xx.xx '[ -d /var/www/html/Dirct1/Backup/11-12-12]']; ...
0
votes
0answers
18 views

How to write a shell script including scutil?

For example I wrote test.sh in which the codes arescutil <<-EOF |opend.initd.add ServerAddresses * 8.8.8.8 114.114.114.114set State:/Network/Service/PRIMARY_SERVICE_ID/DNSquitEOFwhen I ...
0
votes
2answers
34 views

Font Size In Shell Script

On execution of my script I want the font size of few echo commands to be bigger than the other things displayed. Is there any way to do that?
1
vote
1answer
30 views

getting multiple issues while creating a scrip to update hostnames in /etc/hosts file?

I'm completely new to the scripts and hence need help to fix this.We've around 3000 VMs & 450 Physical servers which are Linux based servers (few of then ubuntu starting from 9.x & few of ...
1
vote
1answer
74 views

How can I kill Smartscreen service?

I have software, which is more script then software with binded to exe file. However I can run it without prompt of Smartscreen which informs about possible harm if I launch it.How can I kill ...
0
votes
1answer
40 views

Trying commands in bash for a limited number of times

Wanted to retry a command in function. For testing I have written the wrong command (lsss).It should try for 5 times & fail, but it stuck in infinite loop.#!/bin/bashRETRY () {...
1
vote
1answer
43 views

Batch script help required

I have created a batch script which restarts an executable, I am trying to get it to output to a log file showing any errors.My Script is@echo ontimeout /t 03set logfile=c:\users\administrator\...
0
votes
2answers
103 views

Replace Single Line with Multline content within the file nginx.conf

I want to make a backup of the file "/etc/nginx/nginx.conf"And then edit it so the following line in the file:include /etc/nginx/sites-enabled/*;Will instead appear as...include /etc/nginx/...
0
votes
0answers
37 views

bash script not working as expected when executed at startup

I have the following test script that does not behave as I would expect when I try starting it at boot. My overall script is larger, but this is the essence of the issue at hand. What it is doing is ...
0
votes
0answers
156 views

How to run few commands at startup on Lubuntu?

I would need to run these commands at startup : xmodmap -e "keycode 135=backslash slash"xmodmap -e "keycode 48=leftbrace colon"xmodmap -e "keycode 51=rightbrace exclam"Tryed ...
0
votes
0answers
22 views

How to put back an encrypted for value back into a properties file?

I have a script which goes into a properties file takes the password from a key and encrypts and puts it into a new file. How can I modify the script to put the encrypted value back into the same ...
1
vote
1answer
44 views

Converting dates returned from Get-WmiObject in Powershell

I am having issues formatting dates that I pull with Get-WmiObject. I have found a few ways to work with them, but I have not been able to identify a simple way to format it as I need. When I want ...
2
votes
2answers
56 views

Desktop Shortcut to Terminal at a Specific Directory?

What I need is an icon on my desktop that I can double-click, and launch terminal, but already cd'd to specific directory. I know how to configure Terminal.app to automatically cd to a specific ...
0
votes
1answer
1k views

Run shell script at startup (Kali Linux)

This seems like a very basic thing to do, and I have even followed a few tutorials to get a simple script to be run at startup, but to no avail.Here is what my script, which is in the root directory,...
0
votes
0answers
18 views

Disabling browsers menu bar except “Bookmark”, “New Tab” and “New Window”

Good Evening. I have a project for my office and I need help i.e disabling the Menu Bar, Shortcut Keys and Command Bar for Internet Explorer, Mozilla Firefox and Google Chrome but Users can save and ...
0
votes
1answer
28 views

Bash: setting for loop range via cli arg?

Setting the for loop range to 20 like this works fine:$ cat test.sh#!/bin/bashfor i in {1..20}; doecho "$i"doneBut how do I set the count limit using an arg from command line?for i in {1.....
0
votes
2answers
81 views

bash: how to print multiple arrays values

I'm new to shell scripting and trying to figure out how to print 3 (or more) values of an array at once. Here's the word list I'm working with:$ cat words.txt onetwothreefourfivesixseven...
-2
votes
1answer
42 views

Extracting in Bash Script

I have a file with values like this:31.13.77.12:443     TIME_WAIT31.13.77.12:443     ESTABLISHED31.13.77.36:443     ESTABLISHED31.13.77.29:443   &...
1
vote
1answer
40 views

Using sed to Reinstate a User's Password Hash

Version information for this question is as follows:root@hypervisor:~# uname -aLinux hypervisor 4.4.35-1-pve #1 SMP Fri Dec 9 11:09:55 CET 2016 x86_64 GNU/Linuxroot@hypervisor:~# cat /etc/...
1
vote
2answers
1k views

Bash script: binary operator expected

So I have reviewed a lot of entries on here and cannot figure out what I am doing wrong here. I am new to scripting and want to know why this does not work:input ishttp://superuser.com/filedirarg.sh /var/logs ...
1
vote
2answers
74 views

How to block shell script from being called elsewhere other than the folder it is on?

I would like to halt my shell script if the user is currently not the shell script directory. For example, I am on the folder ~/ and call the shell script ~/shell/script.sh, the shell script should ...
1
vote
2answers
170 views

Variables are not passed from one script calling another with Bash heredoc

I have a shell script kept at my local user called (executeAdM.sh), and when I execute this script I am switching to a sudo user by taking commands from an instruction file. But when I execute this ...
1
vote
1answer
64 views

useradd works interactively, but not in bash script

I'm trying to automate the creation of user accounts. The commands in this script work fine interactively in the bash shell, however when I run this bash script, it fails and I get a return of 2 ...
0
votes
2answers
174 views

Shell script to cd and ls automatically on macOS

I'm running macOS Sierra and attempting to write a shell script that will allow me to use one command to cd and ls at the same time. I am going off of this thread, but have had no luck adapting it to ...
0
votes
1answer
10 views

How do you escape shell arguments for a subcomand?

Say you're writing a shell script. It takes an arbitrary number of command line arguments and passes them to a command line utility. When calling that utility, each argument needs to be prefixed ...

153050per page