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
522 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
10k 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
188 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
411 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
682 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
4answers
2k 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
132 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 ...
10
votes
4answers
10k 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
203 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
155 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
513 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
265 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
351 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
821 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
638 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
2k 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
163 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
565 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?
0
votes
2answers
120 views

HDI script fixed (non-interactive) input in a command-line gui program?

I want to create a simple script that initiates a simple gui-based program (think ncurses-style, text-based graphics in a shell) in Debian. I only access the server through SSH, so I can't do ...
6
votes
4answers
11k views

printing colored text using echo

I know that for printing a colored text using echo, for example red color, the code is: echo -e "\e[1;31m This is red text \e[0m" and I know that in this example, 31 is code of red color and the ...
4
votes
3answers
3k views

Execute remote script with local parameter value

How can I automatize this task? 1) You are at A. 2) You ssh into B. 3) You run a script at B, that needs a parameter known at A. First, I thought perhaps I could send the value when I opened the ...
2
votes
1answer
243 views

How to add variables to script output?

A program to calculate statistics outputs its data in this format Calc_Statistics -input_data ...
5
votes
2answers
550 views

How to parse many variables to bash?

A program outputs its data in this format: n=4607356 null_cells=5668556 cells=10275912 min=0.0433306089835241 max=0.53108499199152 range=0.487754383007996 mean=0.40320252333736 ...
6
votes
1answer
508 views

Peculiar piping grep/head behavior

I'm helping the netadmin here with a perl regex to automate operating on some snapshots from our SAN and our scripts does stuff like this: varinit1=$(iscsiadm -m session | grep rbmsdata1 | head -n1 | ...
3
votes
2answers
684 views

is there any command like “wall” that runs a “command” in all terminals

as you know "wall" command sends a message to all terminals: wall message now my question is this: is there any command that can send a "command" to be run in all terminals? for example sending ...
4
votes
2answers
209 views

Exiting a pipeline if a former command fails

I'm trying to check the number of running and queued PBS jobs by parsing the output of qstat -tn1 from a bash script. So far, this has worked: count () { qstat -tn1 | awk ' BEGIN { R = 0; ...
3
votes
4answers
2k views

cut / grep and df -h

How can I grep or cut the "173G" under "Verf"? I need this for Unix scripting in school. jonas@jonaspc:~/$ df -h /dev/sda2 Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf /dev/sda2 ...
0
votes
2answers
849 views

Re-assigning (specifically, incrementing) a variable in a bash script [duplicate]

Possible Duplicate: How can I do command line integer & float calculations, in bash, or any language available? I would like to simply re-assign a variable (to be specific, increment it ...
1
vote
4answers
427 views

Is learning a text editor like vi necessary and still worth the time today? [closed]

I started a new internship where all the servers run on AIX. Logging in for the first time I was suprised to see that my favorite text editor nano was not installed. Everyone here uses vi not ...
2
votes
4answers
1k views

chown all files based on file name pattern in current directory

I'm trying to chown all files whose filenames begin with ChownFileNames. I've used this command, but it doesnt seem to work: find . -maxdepth 1 |grep 'ChownFileNames*' -exec chown hadoop:hadoop -- {} ...
1
vote
2answers
426 views

Bash script to ftp only files of type gz in current directory

I have a bash script that cd to the right directory then uses the mput command to ftp all the files in the directory to a remote server, as below: for from_dir in $DATE_LIST do cd ...
4
votes
1answer
451 views

KTorrent: Moving data in a shell script

I'm trying to make a script for my magic folder that will move files to a seeding directory without KTorrent losing track of where the data is, similar to the "Move Data" context menu action in the ...
2
votes
4answers
1k views

Loop with 2 variables in a bash script

I am trying to utilize an API. I need to either do some type of "for loop" that replaces or utilizes 2 variables... In pseudo.. # Declare New Servers newserver=( box001 box002 box003 box004 box005 ...
2
votes
2answers
4k views

How can I trim the carriage return from text that is being piped in bash?

I'm using this command to get my last typed command: history | cut -c 8- | tail -n 2 | head -n 1 It works very well in bash, removing the line numbers, but there is one problem I have with it, (er, ...
4
votes
3answers
1k views

In linux, would it be possible to run a script every day 3 minutes later than the previous day?

My first solution to this was to execute date +%Y%m%d%H%M and put that format of numbers into a file, and run the script every minute from cron. Then if the date from the file matches the date ...
2
votes
2answers
261 views

Quick and dirty way to run a process more than once

I am looking for very simple bash script that would allow me to launch a process a few times. What's essential to me is that after the processes terminate, everything will clean up automatically. ...
1
vote
2answers
120 views

How to parse fields out of a text file and write them to another file

I have executed a database command and have generated an output file of the results. Each field name starts with dbt_xxxxxx Each field value is the value after the equal sign. how can I parse the file ...
-4
votes
2answers
772 views

How to write bash script that deletes the oldest file in a directory if there are greater than N files in the directory?

Wondering how would one go about writing a script that: Counts the number of files in a directory. If that number is greater than a specified number N, delete the oldest file in the directory. For ...
1
vote
1answer
861 views

How to open a local URL (webpage) on the command line

On MacOS X I can run open /some/path/index.html and this would open the page index.html with the default software that handles .html files. Is there something similar on Ubuntu Linux? I have used ...
2
votes
1answer
898 views

Shell script filtering through jpg files attributes

I'm trying to find a way to filter through thousands of jpg files, and keep only the files with a certain attribute (such as the camera brand with which the picture was captured). How can I do so?
6
votes
4answers
4k views

Parallel execution of a program on multiple files

I have a small script that loops through all files of a folder and executes a (usually long lasting) command. Basically it's for file in ./folder/*; do ./bin/myProgram $file > ./done/$file ...
2
votes
1answer
127 views

How do I detect whether changes in nano were discarded or saved?

I am currently writing a small setup script for a Linux application that needs the user to edit a configuration file before the application is started. I've chosen to make the script simply open the ...
4
votes
4answers
571 views

How to add a line to a file which has only root write permission and to continue the script execution

I am trying to learn bash scripting. I am working on a practical problem and at one point I need to add a line to a file which requires root permission to write. The code looks like this: # some ...
1
vote
2answers
417 views

how to detect command interpreter from within a shell script [duplicate]

Possible Duplicate: How to test what shell I am using in a terminal? For example the following script #!/bin/bash issue_interpreter_name would issue: bash
1
vote
2answers
1k views

How can I rewrite the From: address of an email and resend it?

I have a cPanel web hosting account. On this account I have a PHP-based support/trouble ticket system for my customers to use. I'd like to be able to send an email to both my customer and to the ...