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 (1)

0
votes
0answers
10 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 ...
2
votes
2answers
510 views

securely automating a script which requires a key to do its task

I have a script that downloads bank transactions to store in a database. To get these transactions requires a password for each account. The database is encrypted and requires a key to access it. All ...
1
vote
1answer
19 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
31 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
17 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
0answers
46 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
30 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
56 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
185 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 ...
180
votes
23answers
114k views

Repeat a Unix command every x seconds forever

There's a built-in Unix command repeat whose first argument is the number of times to repeat a command, where the command (with any arguments) is specified by the remaining arguments to repeat. For ...
2
votes
1answer
44 views

Storing one bit of information in user space [on hold]

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 ...
-3
votes
0answers
22 views

Write a script that will send the following information to the [on hold]

Write a script that will send the following information to the screen, in the following format: Month Sales ===== ==== January 200 February 300 March 200 April 200 May ...
2
votes
2answers
216 views

How can you get ping to print human readable timestamps?

Ping can print you a timestamp on every line but its in unix date format :( ping -D localhost PING localhost.localdomain (127.0.0.1) 56(84) bytes of data. [1415629479.482938] 64 bytes from ...
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
24 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 ...
3
votes
3answers
64 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, ...
1
vote
1answer
78 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 ...
21
votes
12answers
8k views

Object-oriented shell for *nix

Preface: I love bash and have no intention of starting any sort of argument or holy-war, and hopefully this is not an extremely naive question. This question is somewhat related to this post on ...
0
votes
0answers
15 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 ...
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
93 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 ...
2
votes
2answers
509 views

Import single rows from SQLite to MySQL?

I need to do some kind of incremental import again and again from a SQLite 3 database to a MySQL database. Column names are the same in both databases. Is there a good way to do this by a script ...
4
votes
2answers
97 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
169 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 ...
2
votes
2answers
518 views

Script that unpacks a initrd, allows editing of the preseed.cfg and the packs it to cpio and gzip again

I want to program a script that allows what is said in the title. So basically I gunzip the initrd, than unpack the cpio, open vi to allow editing, save, pack with cpio, and gzip again, so nothing ...
0
votes
2answers
30 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 ...
-4
votes
0answers
27 views

backup script to copy files in multiple di

Below script will list keyword from check.conf and search for those keyword in app dir. If match keyword file is found then it copies that file from App to /Data10 location. I have multiple dir's, ...
3
votes
3answers
13k views

Pass command line arguments to bash script

I am new to bash script programming. I want to implement a bash script 'deploymLog', which accepts as input one string argument(name). [root@localhost Desktop]# ./deploymLog.sh name here I want to ...
0
votes
0answers
24 views

How to write shell script on shared application on one server to pickup specific customer PID for command processing? [closed]

I have a script which runs on a dedicated environment and processed the running PID to generate heap dumps. The problem I am having is on a shared environment where there are different customers ...
1
vote
1answer
35 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
1answer
1k views

Using alias in another script (ksh)

I'm writing a ksh script, and I'd like to use a command define by an alias in my .profile file, in my script. I tried this command in the folder containing my script, and it works. However, in my ...
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 ...
8
votes
2answers
492 views

Command to move a window to all desktops

I'd like to be able to move (pin) an existing window to all desktops using a scriptable command, rather than through the window menu. wmctrl -r <WIN> -t <DESK> will move a window to a ...
3
votes
0answers
18 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
30 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
10 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
56 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 ...
0
votes
1answer
1k views

How to execute Netscaler commands through a remote machine via SSH connection

I have been trying to execute some NetScaler commands like "bind" & "unbind" through a Linux Box via an SSH Connection. Now the Problem is, Manually we are able to enter & execute commands on ...
6
votes
1answer
593 views

Can capabilities be used in scripts without setcap'ing the interpreter binary?

Right now I'm using cap_net_bind_service MY_USERNAME in /etc/security/capability.conf. Now I just need to set cap_net_bind_service+i on the interpreter of my favouite scripting language to be able to ...
72
votes
6answers
43k views

Allow setuid on shell scripts

The setuid permission bit tells Linux to run a program with the effective user id of the owner instead of the executor: > cat setuid-test.c #include <stdio.h> #include <unistd.h> int ...
1
vote
1answer
28 views

How to move directories based on the output of rhash (CRC32 check of .sfv) with bash/perl?

My idea, is to move the CRC-check OK folders (albums) into a lets say "complete+CRC_OK" folder with a script once per day in cron. I would need to put the rhash command in a loop with number of ...
16
votes
4answers
584 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
36 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 ...
2
votes
2answers
4k views

grep output of expect script

I'm trying to run some expect language, and grep/parse the output all in one script. I want to grep the output of and look for "error" (I should note that standard linux commands like awk, sed, grep, ...
-1
votes
1answer
74 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
17 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 ...