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)

3
votes
1answer
48 views

Export passwords from the `pass` password manager

I've been using the pass password manager for a year or so now, and it's awesome, but sometimes I like to test other password managers and then I need my passwords back. So far I've just been adding ...
1
vote
1answer
99 views

Startup script with LSB headers not working correctly (dependency problem)?

I am creating a startup script for my Ubuntu 14.04.1 LTS server. The script need to be run after the Rabbit MQ server. The Rabbit MQ startup script says it provides "rabbitmq-server". So I put this ...
1
vote
3answers
63 views

How I can determine the latest version in URL?

I'm trying to put a "function" inside of a script to install the latest version of "TeamSpeak3" Client and make all configurations. My problem is I don't know how to make a function to test the ...
1
vote
5answers
99 views

find the max value of column 1 and print respective record from column 2 from file

How to find the max value from the column 1 and echo the respective path location from a file which contains n number of records. $ cat version.log 112030 /opt/oracle/app/oracle/product/11.2.0 ...
0
votes
0answers
11 views

Directly start an application in a new screen/tmux session [duplicate]

Is there a way to start a new screen or tmux session, which directly executes a given command/application then detaches again? In pseudo-code something like tmux new -s ft_session --execute python ...
1
vote
1answer
49 views

Add 10 to a value in large xml file

I have in a large xml file some hundred svg graphs where I want to change the <svg:g transform="matrix(1 0 0 1 59.06 88.74)"> 88.74 to 98.74 i.e to add 10 to every line that starts with ...
6
votes
1answer
502 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 ...
2
votes
2answers
460 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 ...
7
votes
4answers
2k views

How to constraint time a program runs in Linux?

I have several simulations to do, each is invoked with python simulate.py <parameter list>. The problem with these simulations is that some of them hang without quiting, which prevents me from ...
-2
votes
0answers
37 views

making a delete script and a restore script

I'm looking to create two scripts; one to "delete" a script, and one to "restore" I need "del " where this will move the file located at to the dustbin directory in a way that will allow it to be ...
1
vote
0answers
26 views

Restore Trash Script not working

I made a script to send a file to a trash folder... echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" read ans case "$ans" in Yes) echo "$(readlink -f "$1")" >> ...
0
votes
1answer
23 views

Cannot stat error?

Running a "restore" script which moves a file previously deleted (moved to a trashbin folder) back to where it came from. Running the secondary script I receive this error... "mv: cannot stat `test': ...
2
votes
3answers
64 views

Writing a script that outputs local users and their password expiration date

I'm new to Linux and scripting, and was doing a practice problem and am stuck on it. I'm supposed to write a script that outputs local users real name and their password expiration information. This ...
1
vote
0answers
69 views

Maintain screen session when executing shell script on boot

Solved: I solved this problem by introducing a delay before executing the script: @reboot sleep 60; /root/start_server.sh On Ubuntu 14.04, I have a crontab entry set to run on reboot: @reboot ...
3
votes
2answers
55 views

One for loop for many tasks

The output of this code is two txt files. Can I make one for loop for both of them. i.e one for loop to give me two or more outputs? In ID1 and ID2 I have names for files. I want to print the first ...
4
votes
6answers
184 views

Search for an user name in file and output the user's phone number

First I made a file called telephone containing: Jan;032569874 Annemie;014588529 Hans;015253694 Stefaan;011802367 And what I now need to do is make a script where the user inputs a name ...
-5
votes
1answer
60 views

Merging spreadsheets?

I have a list of LibreOffice spreadsheets (xls files) each one has one sheet. I wanted to merge all those spreadsheets in one big spreadsheet including all the tabs/sheets inside it. For example: lets ...
2
votes
1answer
28 views

Scripting: Counting users logged in onto the system

I need help with the following script. #!/bin/bash #Solution script1 who date +"Today %d %B, there are $# users logged in onto the system" In the background user1 has looged in onto tty2 and 3 and ...
0
votes
4answers
89 views

Can you put an if statement within an until loop?

We have to make a script with one until loop to repeatedly ask the user for a number. - If the number is not 50, display the message, “Wrong number; try again.” - ask for another number. - If the ...
1
vote
1answer
43 views

How do you make case statements with ranges

I'm supposed to: Make a case statement that will display the a grade after input. With no loop or conditional. A=90-100, B=80-89, C=70-79, D=60-69, F=0-59 This is what I have so far: ...
2
votes
1answer
487 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 ...
5
votes
3answers
554 views

Shorter command for deleting files

Our web server was originally maintained by a different company. They wrote a short script to clean out cache files. Their file has several lines that read like this: /usr/bin/find ...
2
votes
2answers
83 views

Inputting user input automatically through bash script? [duplicate]

I am creating a bash script which creates a user and sets a password. When the command "passwd user" is run it requires the user to enter a password and stops my script. Is there any way to fulfill ...
0
votes
1answer
3k views

Automating excel report

Could you please help me for the below concerns. I'll be executing one script which gives some output Have to arrange them in a table format in excel Attach the excel and send it through mail ...
3
votes
4answers
385 views

Run a script on multiple shells?

I have two servers one AIX with default shell ksh, the other RHEL with default shell bash. I have a script that is mounted on both that will run similar commands but for either AIX or Linux. This ...
0
votes
1answer
30 views

How do I add text to an output file?

I have a script for doing whois lookups: #!/bin/bash for domain in `cat /Users/jason/Desktop/letters.txt `; do echo $domain >> /Users/jason/Desktop/whois-results.txt whois $domain | grep ...
2
votes
2answers
418 views

Want a seperate file to store mysql username, password, and database name

I have as script that dumps a mysql database, and compresses the file. What I want to do is have another (edit) file which can change the username, password and database name. Then somehow connecting ...
2
votes
1answer
51 views

What is the most portable syntax for `if` statements?

(NOTE: There is a very similar question, asked yesterday oddly enough, but it doesn't cover the main syntaxes I'm concerned with. If I were to update the other question to include them it might ...
0
votes
2answers
35 views

Grep matching cell of the csv file and index of that row

I have csv file and I want to see numbers that start with 0.99 and their row's index which is the first cell of that row. This is what I have so far: cat fil.csv | grep '0\\.99'| tee > (cut -d, ...
1
vote
1answer
130 views

sed: -e expression #1, char 4: unknown command:

Could someone tell me what does this reply mean ? sed: -e expression #1, char 4: unknown command: ` ' I get it when I use : sed -n "$num"p $javaFile >> ~/Desktop/$1_sql.txt for i in `seq 5 ...
2
votes
3answers
3k views

sed - how to replace a single quote?

This works fine: sed -i 's# @driver.find_element(:xpath, "//a\[contains(@href,##' temp_spec.rb against a source of @driver.find_element(:xpath, "//a[contains(@href,'change_district')]").click ...
1
vote
1answer
781 views

bash script select menu

I've many notes gleaned from the web and have written bash scripts to manage them. I've some scripts working that depend on select to make menus. Question: in a nested menu context, is it possible ...
2
votes
1answer
42 views

Sorting image files based on whether the content is picture or graphics: updating an older solution?

Someone wanted to sort files in a directory according to whether the files are pictures(camera) vs. design graphics. On Stackoverflow, there is an older solution/proof-of-concept involving the ...
2
votes
1answer
34 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 ...
2
votes
2answers
34 views

Match missing values in text files

Referring to this question : Finding missing value in text file i have 2 files containing below data example Name Feature Marry Lecturer Marry Student Marry ...
2
votes
2answers
7k views

Use awk to split line into array and use that array's values in calling shell

I am trying to use awk inside a bash script and do a rather common task: iterate well structured file lines and split them by a delimiter into an array. Here is a sample from the file: ...
3
votes
2answers
94 views

Finding missing value in text file

I have a text file with following data. Name Feature Marry Lecturer Marry Student Marry Leader Bob Lecturer Bob Student ...
2
votes
1answer
53 views

Error passing variable from bash to php

I have the following files: vars.txt C=1234567890 Ascript.php #!/usr/bin/php <?php var $C="$argv[1]"; echo "\n $C \n"; $con = mysql_connect('localhost','root','123') or die ("No connected"); ...
1
vote
1answer
144 views

Nmap script execution to detect heartbleed is failing

Wanting to setup Nmap on my Ubuntu 14.04 LTS system to detect HeartBleed vulnerability. I followed the instructions here: ...
0
votes
3answers
45 views

Reduce length of specific column in delimited text file

I need for the 5th column in a delimited text file to be reduced to just the first 5 characters. All other columns must remain unedited. Input: file1.txt column1 column2 column3 ...
0
votes
1answer
25 views

running script with -o argument pointing to mount point of sd-card

I was trying to install Angstrom Linux on Colibri T_30 board---but I am stuck at one point where it specifies that run update.sh script with optional -o argument pointing to mount point of ...
1
vote
1answer
28 views

Running for loop with two variables? [duplicate]

How can I run for loop with two variables or in other words is it acceptable to do that? I will clarify my question by the following example: I have a list of letters included in a text file ...
3
votes
1answer
4k views

script to automate scp in network

I have a network full of Linux machines. In this network, I have a user as user1 with the password as password in all the machines. I have the following script to put files in the home directory of ...
2
votes
5answers
149 views

Re-order text on each line in a file

I'm processing a log file and I need reorder each line (not sort). The log file looks like this: 11-06-2014 - 10:49:06PM lat = 41.858657; lon = -91.345142 11-06-2014 - 10:49:49PM lat = ...
1
vote
0answers
35 views

Hotmail not receiving emails from a script, but works from the server

I have a working mail server running Debian stable, the following elements are working. SPF DKIM rDNS My IP is not listed in any backlist, I used: mxtoolbox.com for all this. My problem: Sending ...
2
votes
4answers
88 views

How to display the IP address of the default Interface with Internet connection?

I need to create a script that outputs the internal IP address, that is configured as the default Interface.
3
votes
1answer
56 views

Scan ~/Downloads on new file creation

I want all new files added to ~/Downloads (and sub-folders) to be scanned with clamscan. When using Firefox on other OSes/Machines I've noticed that downloaded files sometimes get automatically ...
15
votes
2answers
324 views

Using the setuid bit properly

I have a process that needs root privileges when run by a normal user. Apparently I can use the "setuid bit" to accomplish this. What is the proper way of doing this on a POSIX system? Also, how ...
12
votes
3answers
20k views

File extensions for unix shell scripts

On wikipedia, the article for .sh says: For the .sh file extension type, see Bourne shell. How about other unix shells? I know that the shebang is used inside the file to indicate an ...
1
vote
1answer
55 views

Get two values from command output in a bash script

I have a bashscript, which executes a command and calculates a pair of values, which output can look like this. a,b (10.0000000000, 10.0000000000) -> volt (2088133.7088034691, -222653.3238934391) ...