A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

learn more… | top users | synonyms (2)

1
vote
1answer
21 views

Extracting duplicity backup data

I've made some backups of my previous systems using Deja Dup (duplicity). In my current distribution it's not available, so I've simply extracted the data. Now in order to make that data meaningful ...
0
votes
1answer
52 views

Run script on multiple hosts [duplicate]

I have below script which creates user list and also filters ignore.txt file to ignore matching usernames. I would like to run this script on multiple hosts like hostA, hostB, hostC. Like if I run on ...
1
vote
0answers
14 views

Run a script on window focus [on hold]

I have a wacom tablet and I'd like to change the button configurations when I change applications. I figure I should run a script to override the previous xsetwacom configuration every time the focus ...
1
vote
0answers
21 views

Need help with a network manager command line script

I am looking for some help in creating a script. As RHEL boots up and I login, I'd want to manually run a script which would: Identify the active ethernet interface (the eth ID being used). Ask ...
-3
votes
3answers
54 views

Delete line from files

I have 8 files in a folder. If any of these files has 2 lines I need to remove the second line from that file. If a file has more than 2 lines then then I do not need to do anything to it. Can anyone ...
0
votes
0answers
22 views

RHEL Bash Script for Oracle WebLogic - Run command as another user; No such file or directory

I'm trying to run a test script which switches to a WebLogic 10.3.6 user and checks the status of the admin server. The script works fine when the variables are replaced with absolute paths, but this ...
0
votes
0answers
20 views

Make a downloaded script automatically executable [on hold]

I was making an script to send to a friend to fix some problems in his computer. I was thinking about give to file exe permits and my friend just have to double-click in the file, something like ...
1
vote
1answer
29 views

delete redis keys that have been inactive for 30 days

I've installed a web app called scrumblr which uses redis as a database. What I am attempting to do is delete all keys that have been inactive for 30 days, or have not been accessed in 30 days. I ...
2
votes
2answers
66 views

Change Password Programmatically

In the current version of Raspian, I know it is possible to change the password of the current logged in user from the command line like so: sudo passwd which will then prompt the user to enter a ...
-1
votes
1answer
28 views

Quoting a URL string containing & in sh script [on hold]

I want to put quotes "" marks around a string which has the & symbol in it. If I echo the string, the shell treats the string as two commands, ie. separated by the &. Looking for something ...
1
vote
0answers
16 views

How to disable AC power supply from CLI

This article among others suggested the following to prolong battery life: Keep cool. Operate in mid SoC of 20–80%. Prevent ultra-fast charging and high loads (most Li-ion) The main issue here ...
1
vote
1answer
20 views

How to change configuration of detox (dash instead underscore)?

I found, best to this moment, a solution when changing all those annoying filenames in large quantities, making them readable and easier to manipulate with in command-line. So I found, among many ...
0
votes
1answer
33 views

Filter grep output

Using grep "val" index.php I get the list <td class=val> 7.6</td> <td class=val> 58</td> <td class=val>1013.8 </td> <td class=val> 1020 </td> <td ...
0
votes
1answer
18 views

Connecting to Windows server from unix through script

I am trying to connect to a Windows server say 10.1.1.10. This servers has a folder named RAJ in which there are multiple .zip files. All these zip files contain a text file called XYZ.txt. Now i have ...
0
votes
1answer
61 views

How to parse an awk variable

I'm trying to pull some information out of a log file, looking back over a specific period of time (e.g. the past hour). I've found the following awk construct that works, capturing the data as a ...
0
votes
2answers
32 views

Change only the year on the output of the “date”-command

date for example displays Fri Apr 17 20:16:01 IST 2015 Now I want to change only the year so date should display Fri Apr 17 20:16:01 IST 2016 in this example. How to add 1 year to the output of date ...
2
votes
3answers
62 views

Command line options with argument in shell script

I have a script to get ldap user name, email and mobile number: #!/bin/bash echo -n "Enter Unix id > " read UNIXID ldapsearch -x "(cn=$UNIXID)" | awk '/givenName/||/mobile/||/mail/' Here is the ...
4
votes
2answers
190 views

Best and short way to run a program if another is not installed

I have this code: #!/bin/bash num=${1:-undefined} cmd=$(which {banner,echo} | head -n1) until [[ "$num" =~ ^[0-9]+$ ]]; do read -p "Type a number: " num done for ((num;num>=0;num--)); do ...
2
votes
1answer
44 views

Storing one bit of information in user space [closed]

I'm writing a program that collects network data. I need to store one bit of information, a simple yes/no, somewhere so another process may read it. I have several options: writing a 1 or 0 to a file, ...
0
votes
0answers
20 views

Create complex installation script for Linux (Centos)

For deployment of a complex system I would like to create a script that runs all compilations and set up. I am looking for an existing product that interpret installation scenario and performs all ...
0
votes
0answers
42 views

Need to have password coded in script [duplicate]

I have to login many Servers day in day out by supplying passwords manually. Now I want to know or have a script where from I can login to any server without password (I mean to say if the ...
3
votes
0answers
26 views

Automatically restarting process in the X server

I would like to know how to have a process that starts with the X server and automatically restarts when it stops running. I am running Ubuntu 14.04 with a KDE 4.13.3 desktop. I am running the ...
0
votes
0answers
17 views

check media resolution if resolution is big ffmpeg it, if output is smaller than original delete the original else delete the output

I have my storage VPS filled with videos, and hoping I can free up some space, their resolution is pretty big so I decided to re encode them with ffmpeg to a smaller resolution, I am doing every thing ...
3
votes
3answers
67 views

How to run a script on a remote host when I lose connection to it?

I'm working with the BeagleBone Black, which runs Debian Linux, and sometimes I will lose wireless connection to it while I am testing my programs. This wouldn't necessarily be an issue on its own, ...
0
votes
2answers
45 views

How to search recursively in a directory for different files?

I have a x.tar file in directory /a. After untaring x.tar I got the following result: cust/ cust/01/ cust/01/INFENG/ cust/01/INFENG/scr/ cust/01/INFENG/scr/test.scr cust/01/INFENG/SQL/ ...
2
votes
3answers
98 views

remove all instances of _000 from multiple files

Had to recover my music library from a HDD which died.... got everything I wanted but all music track names have _000 added at the end. I really don't fancy going through 8000 individual music tracks ...
1
vote
1answer
90 views

Sed command that would ignore any commented match

I'm trying to create a sed command using regex in order to substitute something in a text file only if it is not commented but I'm running into some troubles due to my almost non-existent knowledge of ...
-4
votes
0answers
35 views

Backup script to copy files in multiple directories [closed]

The following script will list keywords from check.conf and search for those keywords in the app dir. If a matching file is found, it then copies that file from App to Data10. I have multiple ...
4
votes
2answers
100 views

Safely exiting while loops in bash

Say I have a bash script that does: while : do foo done I would like to be able to run this script from the console and be able to exit it at an arbitrary time as long as it happens in between ...
2
votes
3answers
172 views

AWK & Bash: Checking that a User's Home is Owned by the User

I'm trying to cycle through /etc/passwd with a single-line command in order to find those users who have a home directory which is not owned by the user, but I'm VERY new to bash programming, and I ...
1
vote
1answer
36 views

Displaying “No Results” When AWK Command has no output

I have the following code, thank-you to the people who helped me here awk -F: '{if(system( "[ -d " $6 " ]") == 1) {print "The directory " $6 " does not exist for user " $1 }}' /etc/passwd However, ...
1
vote
1answer
41 views

shell script for date checking between two days

There is date in my file, like 30-apr-2015. How can I compare this with the current date and get notified if they are equal?
-1
votes
2answers
38 views

Linux Bash Scripting Issue with Wildcard

I'm having issues with what I imagine should be a simple bash command I'm basically just trying to loop through a bunch of files and get there names `ls ./*.sql` # list all files ...
0
votes
2answers
33 views

How to scrape multiple IP's and add in a script as a variable?

I am trying to add in my script an awk statement or a: if; else; then if eth0:4 is a match then put in eth0:4 IP How would you get the IP in your script as a variable if you have multiple IP's ...
1
vote
1answer
39 views

Rsync Excludes Folders

I am running a rsync script and I want to exclude certain folders. I know with rsync you have to create a .txt file and add all the excludes in there but I am wondering is it possible to just have a ...
3
votes
0answers
19 views

End recording once silence is detected

I've been using something like this up to now: End sox recording once silence is detected But now I'd like for the audio source and recording mechanism to be separate. I can get the source as an ...
0
votes
1answer
32 views

Printing conclusion at the end of script

In this example code I have numbers in the file "list.txt" I wanted to create folders in a specific location "target" for every number in the file "list.txt". In order to do so I used for loop as the ...
0
votes
1answer
44 views

How to change bash script output when the script is running?

I have the following loop which counts from 0 till 99: #!/bin/bash for ((i=0;i<100;i++)); do echo $i sleep 1 done Is there a way to change the result of the output from terminal while ...
1
vote
0answers
13 views

VBox headless: install Archlinux without RDP

I have script to setup headless machine on remote headless server, connected by ssh. It will create machine, attaches disk and archiso, and launches installation. Also, I have script to setup ...
1
vote
1answer
58 views

How to determine interface RUNNING state without ifconfig?

Some background: sometimes my wi-fi connection suddenly goes down so I type sudo ifconfig wlan0 and check for the word RUNNING. The corresponding line looks like: UP BROADCAST RUNNING MULTICAST ...
16
votes
4answers
590 views

How can I implement a circular flow of data among interconnected commands?

I know of two types how commands can be connected with each other: by using a Pipe (putting std-output into std-input of the next command). by using a Tee (splice the output into many ...
2
votes
1answer
38 views

Need to press enter to get prompt after executing udev script

I have set a simple udev rule for my Raspberry Pi (Debian) to automatically mount an USB HDD. It just runs a script which mounts all devices in /etc/fstab since it's the only one I have and I'm going ...
-1
votes
1answer
77 views

Syntax Error: unexpected end of file — Bash script [duplicate]

I am trying to create an spritz app! Everything was working fine, but since yesterday I keep getting this error: ./spritz: line 176: syntax error: unexpected end of file I have checked the script ...
0
votes
1answer
20 views

How I can change all symlink to the new path [duplicate]

Please, I want to change the symlink to the new path My symlink's in this form lrwxrwxrwx. 1 s01 s01 56 Mar 22 13:17 zmjppcxlpq2m.png -> /home/s01/public_html/cgi-bin/uploads/00029/zmjppcxlpq2m ...
2
votes
1answer
47 views

what are practical uses of stdbuf or nohup?

I have to finish a writeup of a few coreutils commands for a course at the moment, and I can't think of a starting point for a small practical code example that demonstrates the potential uses of ...
2
votes
1answer
76 views

bash: how to save state on prompt evaluation [duplicate]

I want to put duration of last running command in command prompt, f.ex: user@host$ sleep 360 6m user@host$ Also, I want duration to not show up if it is less than some minimum threshold (say 30 ...
0
votes
0answers
60 views

grep command with pipes, how to implement in script?

I'm new to expect scripting and trying to get below script to work. The script logs in to a server and reads a config file ($val in the script) for the values of "cps" and then presents a total ...
0
votes
0answers
18 views

DHCP server easy switch

i have a server, running Centos, that bring reserved DHCP for mac to 5 computers, but they have diferentes ip depending on some external parameters, and i change manually everytime, and i want know ...
0
votes
1answer
41 views

User Input Bash Script

I am trying to make a Bash Script that has 4 choices and prompts the user to select an option. Each option corresponds to a Linux Command operation. Can someone give me a bash example on how could ...
0
votes
2answers
48 views

Adding 1 string to end of file, Even when ran multiple times to change MD5

I need to change the md5 of my files, Sometimes once, sometimes multiple times. A friend gave me this script to add a string to the end of the file but i think i may be adding it multiple times when i ...