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
1answer
1k views

/bin/sh: ./check-dependencies.pl: not found — but check-dependencies.pl exists!

I'm trying to build Moses, but when I run make I get the following output: minakshi@minakshi-Vostro-3500:~/Desktop/working-dir/moses/scripts$ make release # Compile the parts make all make[1]: ...
1
vote
1answer
723 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 ...
1
vote
2answers
267 views

Get directory that script was called from

I have a script doSmth in /usr/bin. Is it possible to print the directory the script was called from is printed out by the script? So If I call doSmth from /home/me the output will be /home/me.
2
votes
2answers
482 views

Parse apache logs to exclude IP ranges

I need to look for some requests in a huge pile of apache logs. My only requirement is this: I need to only view the requests coming from any IP address that is NOT included in a list of 50 IP ranges ...
0
votes
2answers
302 views

Why does this fail as crontab but works as script [duplicate]

Possible Duplicate: What’s wrong with these two cron job’s? I want to print a formatted output from a file containing lines of date, time, long number, and long number. I set LC_NUMERIC to ...
2
votes
3answers
278 views

What is the difference between ./script and . ./script? [duplicate]

Possible Duplicate: Using ‘.’ to execute files in bash I was trying to figure out how to export my environmental via script instead of changing my .bashrc file. I found this old useful ...
0
votes
1answer
207 views

How to effectively use bash scripting (different cost reductive ways and good habits)? [closed]

This is one of the most perennially important questions. How to effectively script ? What are the bad ways and what are the good ways ? I know of some, which i will point out here. If anybody does ...
3
votes
1answer
518 views

Open url and fill form automatically

I'd like to create a script to open an url and fill some forms. I don't want to save the form data on the browser, so I think that this script would be a good solution for me. Any help? I know how ...
3
votes
4answers
6k views

Need a loop to sleep for a fraction of second

On my machine I need to execute a cycle that iterates 1 simple command that must have a delay expressed in fractions of second. Let's say that I need: to save a file with an increasing enumaration ...
2
votes
1answer
395 views

Script for courier maildir folders on CentOS LAMP environment

I'm looking for resources to help me build a script to do monthly maintenance of maildir folders for a typical CentOS LAMP VPS hosting environment. I would like to run a script that runs from a ...
4
votes
1answer
208 views

detect if key is pressed from script

I would like to detect if a key is being pressed when running a script. I have the following script: #!/bin/bash sleep 0.5 xte 'str sometext' I run this script using a shortcut to paste "sometext" ...
1
vote
2answers
144 views

Login to super user for running script

I have sample.sh script in /u01/dump location. I'm running it from root. My requirement is while running the sample.sh script it has to be login as oracle1 user using SU (super user) and display all ...
2
votes
1answer
183 views

How do I ensure outbound TCP/IP traffic always uses a VPN, even when using Wifi?

I'd like to ensure that my VPN is started and running, before any TCP traffic from any of my background services send or receive data. How can I guarantee that this is the case? How do I handle ...
1
vote
1answer
816 views

How to manage getops argument assignation

This is my first question. I'm trying to make a small script with options and I'm using getopts to do it. The weird thing is: The argument don't get assigned to the variable or it always enter the ...
2
votes
1answer
441 views

Download file linked in MySQL DB, extract text and insert into db with bash script?

I want to download a file (only download if the url ends with a certain string), which URL is in a MySQL database, extract the text and write the text to the database, by replacing the url. And this ...
0
votes
1answer
646 views

Shell script to recursively grep data from certain files in the directory and return values to file [closed]

I am making a simple shell script which will minimize the time I spend in searching all directories under a parent directory and grep some things inside some files. Here's my script. #!/bin/sh ...
2
votes
2answers
729 views

Quickly check whether many network hosts are up-and-running

Objective: check if a host is up-and-running on the network, with a method that can be efficiently parallelized over many hosts. Emphasis on a QUICK turnaround of the check. Reason to emphasise ...
7
votes
1answer
290 views

How can I tell if xscreensaver has my screen locked?

I'm thinking through alerting stuff, and decided that, if my screen is locked, I'm not there so I should push the alerts to my phone. But, I cannot currently tell if the screen is locked. I could put ...
17
votes
8answers
2k views

The most universal scripting language for Linux is?

We are writing scripts for Linux systems, there has been some debate over what would be the most universally Linux present scripting language to use. Bash, SH, Posix? What?
6
votes
2answers
1k views

Semicolon in conditional structures

Why put semicolons in one and not in another? The result is the same Code one if [ "a" == "a" ] then echo "true" fi Code two if [ "a" == "a" ]; then echo "true"; fi Semicolons in the second ...
4
votes
2answers
155 views

Dealing with script interruption

I need to iterate over between 120k and 500k files. find handles this well. find $PWD -type f -path "fragments/*.pdbqt" For some reason I want to list the same set of files again, in the same ...
19
votes
3answers
8k views

What does it mean to have a $“dollarsign-prefixed string” in a script?

I just saw this in an init script: echo $"Stopping Apache" What is that dollar-sign for? My research so far: I found this in the bash manual: extquote If set, $'string' and ...
2
votes
1answer
871 views

How do I get simple scripts which seem to need root priveliges to run via the www-data user?

I am programming a small webinterface to control samba on Debian (kernel 2.6.32-5-686). I started by writing simple scripts to add users, create folders, etc. They worked fine when run as root. ...
1
vote
1answer
475 views

Parsing SQLite output

Using -line Option I get this output from SQLite: row1_column1 = valueA row1_column2 = valueB row2_column1 = valueC row2_column2 = valueD So one line for each column value and result rows are ...
1
vote
2answers
427 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 ...
1
vote
2answers
605 views

What scripting language or platform to use for web page downloads and screen interaction? [duplicate]

Possible Duplicate: Does anybody here have experience in automating some tasks in web applications using curl? Here is what I need to do? Wondering what platform is most suited - easy to ...
1
vote
1answer
456 views

Error QProcess: Destroyed while process is still running

Edit: I discovered that the problem is not related with the script cited below, but I'll leave it there just for history. Well, this error appears when I close texstudio with the viewer open (xdvi or ...
0
votes
1answer
558 views

Script with root permission [duplicate]

Possible Duplicate: Redirecting stdout to a file you don't have write permission on I am creating a script to change the brightness of my laptop. I discovered that I can do this using ...
3
votes
2answers
11k views

Execute shell script from php, as root user?

Need to execute the following line from PHP: $res = shell_exec('sudo sh /home/nicklas/cronjobs/make_account.sh username password'); The problem is nothing happens on execution. If i try to ...
1
vote
1answer
197 views

TeXstudio: open file at line number n

I am creating a script to produce some .tex files with a lot of lines (a kind of automatic sample). The script finishes with texstudio /home/$USER/foo.tex where foo.tex is the file created before. ...
4
votes
0answers
434 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 ...
3
votes
4answers
713 views

How useful is Linux scripting? [closed]

I am a beginner user of Linux and have worked primarily with GUI. I am trying to move to intermediate level by learning the shell commands. In online Linux forums it's often the consensus that to be ...
5
votes
5answers
3k views

Check if script is started by cron, rather than invoked manually

Is there any variable that cron set when it's running a program ? If the script is running by cron, I'll skip some parts; otherwise invoke those parts. How can I know if the bash script is started by ...
1
vote
1answer
136 views

Using join with two files fails on larger file sizes

I am having some issues with a script that is using join to join two files. Eaxmple input files contains lines like this: Here are the input file and the output of the join command: ...
4
votes
4answers
2k views

How do you colorize only some keywords for a bash script?

I am running some unit test code. The unit test code outputs regular text. There is a lot of the text so I want to highlight for the user important keywords. In this case the keywords are "PASS" and ...
12
votes
4answers
12k views

How can I use bash's if test and find commands together?

I have a directory with crash logs, and I'd like to use a conditional statement in a bash script based on a find command. The log files are stored in this format: /var/log/crashes/app-2012-08-28.log ...
3
votes
1answer
205 views

Locking in a shell script

I want to write a long-running shell script so that only one copy could be run at a time. If the script crashes, I want a new invocation of the script not to be stopped by a lock from the crashed ...
2
votes
0answers
158 views

How to emulate a KWin effect by command line?

I would like to apply the Toogle Invert Effect when I start my system. So, I need to know how to call this KWin effect using the terminal. OBS.: I'd tried xte "keydown Meta_L" "key i" "keyup ...
1
vote
1answer
545 views

Selecting icon for tray notifications from Bash scripts (KDE)

Q: How to make Qt KDE tray notification from Bash script ? A: @SO: Activating KDE 4 notifications from bash scripts Q: How to make notifications from scripts running as root ? A: @Unix.SE: Show a ...
3
votes
3answers
271 views

How to make and apply (patch) one side diff?

I want to make a shell script that updates a config file. The file present on the server has information, like various IP addresses. The new file has more code, from new configs added to the system, ...
4
votes
1answer
90 views

Transform directory structure

I have the following folder structure root folder |-al2 |- GER.zip |- ENG.zip |-ww |- GER.zip |- ENG.zip and so on. The folder names are random strings. I want to sort the files in ...
0
votes
1answer
372 views

How does “options” in shell scripting work?

I found some code in one of the answers here and accommodated it to my needs but now I have two questions: Q1: how can I display the options text after the code in case statement finishes? So the ...
2
votes
3answers
897 views

Copy/backup all dirs containing files matching a regexp

I would like to do a backup where I recursively go through a dir structure and only get directories with files whose names matching a particular regexp. I would like to keep the directory structure, ...
2
votes
2answers
684 views

What would it take to add a command to run a script at the completion any given random task?

I was playing around with Pushover, and had the thought that it would be cool if I could use it as an argument on any random command, so that it would run a pushover script at the end of the task, ...
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 ...
11
votes
1answer
3k views

Making a progressbar with “dialog” from rsync output

I'm looking for a way to filter/redirect rsync output in a manner where it can be fed to the "dialog --gauge" command, so I can get a nice looking progressbar during file sync. Currently I have only ...
5
votes
2answers
2k views

assign shortcut key to run a script

I've written a script to change the brightness of my screen. It's useful when I am working on text mode and shortcut keys of my keyboard to change brightness doesn't work. Is it possible to run this ...
3
votes
3answers
3k views

Shell Script to Execute Shell Script to All Subdirectories

I am making a script to simplify my daily tasks. Everyday, I have to grep for a few things inside a company server. It was okay, however, now, they have segregated each object into sub directories. I ...
0
votes
1answer
169 views

Bugzilla email_in.pl script will take 111 hours to complete - how can I change that?

I have an old Bug tracking system, with about 20k bugs. We have installed a new bugzilla system, and part of the initiation will be to import all the bugs from the old system to the new. I am able to ...
5
votes
1answer
691 views

Which command will open the default browser on a system to a given web page (terminal)?

Title says it all. Is there a way to open the default browser on a user's system to a specific page from within a Bash script, or other-language script?