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
2answers
39 views

How to receive a mail whenever a file gets deleted?

I've accidentally deleted my cron using crontab - command and now the file under /var/spool/cron/crontabs directory got deleted. I would love to have a script which mails whenever my files under ...
-3
votes
4answers
90 views

Comparing 2 files

I have the need via a script to compare 2 files contents and if the contents are different then execute another script however is the contents are the same do nothing. I've tried using the DIFF ...
1
vote
2answers
25 views

Less specific input for script

Some time ago while i was searching for a way to find out what i can delete from my Android rom without crippling functions i use, i found deptree over at the xda forums. Since this was written back ...
1
vote
4answers
60 views

Bash script to read two specific lines from text file and use parts of them as variable

So i got a text file which looks like this # begin build properties # autogenerated by buildinfo.sh ro.build.id=LRX21T ro.build.version.incremental=G900FXXU1BOK6 ro.build.version.sdk=21 ...
0
votes
2answers
75 views

Pausing and restarting all Python processes

I have a server which runs our backend scripts for our database (ETL processes, etc). However, for two hours a day we dedicate it to sending our e-mails. The e-mails are the top priority, however, ...
0
votes
3answers
59 views

Print lines after pattern in several files

I have a file with the same pattern several times. Something like: time 12:00 12:32 23:22 time 10:32 1:32 15:45 I want to print the lines after the pattern, in ...
0
votes
1answer
24 views

Function does not get called and script exits

So i got the function RM_OBJ_P which gets called from the menu page PAGE_RM. This is working, you can enter all the funky filenames you know and if they are in the database, the output gets printed ...
0
votes
0answers
37 views

Scripts timeout using USBMount

I'm using Usbmount (https://github.com/rbrito/usbmount) on a raspbian system to auto-detect the insertion and removal of a usb stick in to the unit and then run a script from the ...
0
votes
0answers
23 views

How to run a custom script on on the default terminal when booting?

I have a Cubieboard (similar to raspberry pi) running Debian, it is set up for ssh access and running some services, it should never be connected to HDMI. I want to show a custom ascii art or ...
0
votes
1answer
27 views

What simple web server script will accept text on a LAN?

I want to dump iphone notes (text) to my Linux box, but don't want to route the data through the Internet. I can get a LAN IP via WiFi on the iphone and the LAN is firewalled, so I should be able to ...
0
votes
1answer
63 views

Are there any implications of closing every if-block with fi in a nested if-construct?

As closing "fi"s for nested if-blocks are not necessary except for when delimiting else-blocks (ref: http://stackoverflow.com/a/15328027/1942997), I was wondering if there were any implications when ...
0
votes
0answers
43 views

Standard deviation of number next to a pattern

I have a file with lots of tags with a number next to them, set out like this: <Score>4 ... other data <Score>2 ... other data <Score>3 and so on... I have used grep to get the ...
0
votes
1answer
36 views

Bash script stopped recognizing substitute file

I've got this script #!/bin/bash name=test.sqlite idx=1 while [ -e $name.$idx ]; do idx=`expr $idx + 1`; done while [ $idx -gt 1 ]; do nidx=`expr $idx - 1`; mv $name.$nidx $name.$idx; ...
1
vote
0answers
24 views

Adding corresponding elements from two arrays into new array using csh shell?

I want to use a csh script to merge corresponding elements of two arrays into another array. My script gives error as:- arrayfinal[1]: No match. the results is 0 0 0 0 0 my script is #!/bin/csh ...
1
vote
2answers
39 views

How can I execute a script as root, execute some commands in it as a specific user and just one command as root

I would like to execute a script as a normal user and execute a command that shuts off apache (which needs a root password). I was wondering if is possible to run the script with sudo but it ...
0
votes
0answers
34 views

tmux script to open a new window and run a script, keeping the window open

I am working on porting a script of mine to use tmux. Essentially it takes a text file and executes a command with each line of said file in it. Right now it uses gnome-terminal and opens a new ...
-2
votes
1answer
69 views

How to find the word before a match

I have the following log file. I need to know if there are any fault / suspect condition using a shell script. I need to find fault and check the previous word, if it is greater than 0 then there is ...
0
votes
1answer
28 views

Parsing a delimited in ksh as command argument

My system generates a flat file with 7 arguments : Field1,Field2,Field3,Field4,Field5,Field6,Field7 Field1,Field2,Field3,Field4,Field5,Field6,Field7 Field1,Field2,Field3,Field4,Field5,Field6,Field7 ...
1
vote
1answer
66 views

Help creating a bash shell script based around the ls command [closed]

I'm trying to create a bash shell script that will take an input directory and give me the name and size (with units) within. I'm a bit new to shell scripts, so I've been able to build the script to ...
0
votes
1answer
56 views

can mmv rename files by incrementing an index?

Can mmv, a mass move utility, nicely rename files from: foo.txt bar.txt baz.txt to: 1.txt 2.txt 3.txt The man page is intriguing, but I don't quite follow the directions: Rename all ...
1
vote
1answer
58 views

Script a mobile recharge website

I recently come to know that I can curl a website using the bash command curl --user user:pass xyz.com I have an idea for recharging my mobile using the bash script. I want to write a script which ...
-2
votes
1answer
47 views

How can I make a bash script that uses the ls -l command on a given argument?

How can I make a bash script that uses the ls -l command on a given argument? I have a text document containing my shebang ect... but when I add the ls -l command, it only works on my cwd. Say my ...
0
votes
2answers
75 views

Arithmetic Syntax Error when running a script in RedHat OS

I am encountering a problem when I try to run a script in RedHat OS. I get an arithmetic syntax error. Now here's the script that I am trying to run: #!/bin/ksh echo "" echo " = K+WA ="; ...
0
votes
1answer
29 views

regex to remove last four characters

Is there a way I could eliminate the last four characters with regex in the below one line script as I convert .wav files into .mp3 files. As of right now my single line script produces files ending ...
0
votes
2answers
56 views

Assign names stored in a file to numbers stored in a second file

I have two files: >head(fileA) 2 1 544.8 1279.2 1.0603 3.2460 0.0542 3 1 546.2 1277.8 1.0463 3.2460 0.0553 3 2 543.9 1280.1 0.1652 3.2460 0.0177 4 1 ...
0
votes
2answers
66 views

Run this PHP file via Cron Job

Here is the script: <?php //Create back files? define('CREATE_BACKUPS', FALSE); if (!is_dir($argv[1])) { echo "You must enter a valid path such as /home/apresv/public_html or ...
3
votes
2answers
215 views

echo $PATH shows path to python scripts, but they cannot be executed

I am new to using the shell, and wanted to create a directory in $HOME where I can put all my python scripts, set a path to that directory, so that I can go into any folder on my Mac and execute those ...
0
votes
2answers
92 views

Help creating script to move files based on date or filename

I have an FTP process that is constantly putting files into a directory. The date created is part of the filename in a format like this: YYYY-MM-DD-HH-MM-SS-xxxxxxxxxx.wav I would like to move the ...
1
vote
1answer
54 views

How do I script deluge to get information about torrents?

Dealing with a lot of torrents is not always convenient when using GUI. I tried deluge-console info, but that didn't give all the info I wanted. So, to make it clear, what I need is a script, that ...
0
votes
1answer
30 views

Reading file using shell script, format of the line has changed

I am reading a file using the following code: displayLine(){ echo $line } filename="SampleFile" while read line do displayLine $line done < "$filename" The format of the file that I am ...
0
votes
1answer
86 views

cp doesn't work in a script but does from the command line

I have this script for automating a simple process where I scan a number into the command line, grep that number out of a catalog file which gives me a path, and then copy the DVD which the above ...
0
votes
0answers
91 views

How to execute a command after ssh login via batch file

I want to execute a set of commands at once I login to a ssh session everytime via a batch file. Eg: start putty.lnk -load "session" -ssh username -pw password -m <commands> Here I am using ...
3
votes
1answer
116 views

What Command Line tools to connect from Unix to remote Windows?

I need to make some scripts for connecting from a Unix server to several Windows stations for automating file transfers. GUI is not needed and I can't install any additional software into Windows ...
0
votes
0answers
18 views

Script acting as textfile, possible? [duplicate]

A program I'm running has a -logFile option. The file I set as a logfile is filling up quite rapidly, and I only need about half of what's actually in it. Is it at all possible to: have a script ...
0
votes
2answers
89 views

Command to skip process if file exists

I have been using a for loop to run a pipeline for multiple files but unfortunately the terminal froze halfway. I would like to run the pipeline again but because of time I would like to skip the ...
0
votes
1answer
24 views

How can I create a single shorcut to open a set of programs?

Currently, I have a set of shorcuts to open several applications. I use xbindkeys to do so. I have something like this: Super + u -> sublime Super + e -> pcmanfm Super + s -> skype Super + x -> ...
0
votes
0answers
48 views

Can a Linux server that authenticates against an Active Directory accept public/private keys for passwordless login?

I have a Linux server that authenticates users against an Active Directory. Now interactive logins require username and password and automatic login requires a keytab (Kerberos) for passwordless ...
0
votes
1answer
11 views

Dificulties in using BASH variable and conditional IF combined

Someone could help me? for k in {1..10001} do if [ -d "$k" ] then cd $k/ testfile="grep Have aims.out | cut -c11-14" cd .. fi if [[ "$testfile" == "Have" ]] then ...
-1
votes
2answers
86 views

how to login a user using shell script [closed]

In my computer i have two user(tiger,jenk) now i want to create a shell script for login user "jenk" from user "tiger" i m try this code [tiger@pagaltiger mytask]$ echo -e "IncorrectPassword\n" | ...
1
vote
2answers
59 views

How to remove prefixes and suffixes from filenames in a given directory?

I have many files with the same prefix and the same suffix. I want to remove both from filenames. Both contain spaces. So foo bar XXX doo par.jpg, foo bar YY YY doo par.jpg would become XXX.jpg and ...
0
votes
1answer
36 views

Kill command also kills other process

I have a very simple script, let's call it foo.sh. It's this: #!/bin/sh sxhkd & panel & where panel is a script (I won't post it here because it's very long and I don't think it would be ...
1
vote
2answers
82 views

Stop bash script with any key

I'm writing a custom gnome-terminal profile which I want to stop with any key I choose. After pressing the key, my intention is to complete all my commands at that moment and start su. I've tried ...
0
votes
1answer
29 views

BASH script presenting IF syntax error

for k in {794..800} if [ -f "vesta_$k.xyz" ] then do mkdir $k mv vesta_$k.xyz $k/vesta.xyz cd $k/ <<COMMANDS>> cd .. ...
-1
votes
1answer
36 views

Search for and kill process in script

I have written a script to stop a Tomcat instance, remove the .war file and application directory, copy a new .war file from a NFS mount to the webapps directory, and then restart the Tomcat instance. ...
1
vote
2answers
36 views

legality of creating a variable for a file location

adapter= /Volumes/My\ Passport/Documents/adapters.fa Can I create this variable so that I can just refer to adapter for the exact file (and its location)?
0
votes
1answer
46 views

Rss in full text

I am looking for a way to extract the full text from an html file in the command line. The purpose of this is to make a blocklet for my i3 status bar. I have found some site with names like "Full ...
2
votes
2answers
29 views

Parameter expansion question

I have 2 files each in user/admin/1/2/[a-c] subdirectories. The files are preQC_1.txt and preQC_2.txt - both of which will be inputs in my tool. I use "${f##*/}" for preQC_1.txt in my for loop for ...
2
votes
3answers
271 views

awk : parse and write to another file

I have records in XML file like below. I need to search for <keyword>SEARCH</keyword> and if present then I need to take the entire record and write to another file.(starting from ...
1
vote
4answers
50 views

Rename files randomly but without repetition

Suppose i have a folder with a lot of file names some very strange and nonsense I want to rename it like File-1 File-2 File-3 .. I have tried this(echo is for tryng) for name in *; do echo mv ...
1
vote
1answer
86 views

generate file names in loop [closed]

DISCLAIMER: I am using Mac OSX. The bash script is in a different directory from the files that require processing. From here my struggle begins… HELP 1: I have multiple files each housed in a ...