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)

5
votes
1answer
464 views

SCO Unix run interactive script when sending a print job

I'm working with (read, "around") a proprietary ERP system on top of SCO Unix. It has several "query at print time" reports where you can assign a printer to send your job to. You usually input ...
5
votes
1answer
121 views

apt-get - How to complain on failed upgrade?

I'm trying to write a script to upgrade a bunch of remote machines and would like to verify that one package in particular is upgraded. With yum, I could say yum upgrade specific-package, and it ...
16
votes
7answers
12k views

Using xargs with input from a file

Say I have a file with the following bob john sue Now these directly corrospond to (in this case) URL pattern such as http://example.com/persons/bob.tar, john.tar, sue.tar. I would like to take ...
1
vote
2answers
274 views

Problematic build script with quotes

Hi I'm trying to create a build script that executes these commands: cd libiconv ../../src/libiconv/configure --prefix=/home/ruben/mingw64/build/gcc-libs \ ...
2
votes
3answers
3k views

Bash eval array variable name

Here is my bash case: First case, this is what I want to do "aliasing" var with myvarA: myvarA="variableA" varname="A" eval varAlias=\$"myvar"$varname echo $varAlias Second case for array variable ...
1
vote
3answers
625 views

How can I write an OpenSuse script that will change my boot menu.lst file and add “nomodeset” automatically both to failsafe and normal boot option?

How can I write an OpenSuse script that will change my boot menu.lst file and add "nomodeset" automatically both to failsafe and normal boot option? (This script is for suseStudio I'm going to write ...
5
votes
1answer
2k views

Replacing multiple lines in sed or awk [on hold]

I'm trying to use sed or awk to replace 5 lines in a smb file but I just don't have any idea how to deal with the newlines.
9
votes
5answers
5k views

Run a script via cron every other week

I've done quite a bit of research in how to do this, and I see there's no direct way in cron to run a job, say, every other Thursday. Right now, I'm leaning toward making a script that will just run ...
4
votes
2answers
348 views

Scheduling command/script by specifying the exact second

I'm using bash and wondering how I can execute a command/script at a later specified time, with the accuracy of a second? I read the man page for the at-command, but as far as I could understand it's ...
8
votes
4answers
8k views

grep — removing text after delimiter token

I have a file in which I need to eliminate everything after the first ; on every line. So a file like this: sdfsdsdf; fsdfsddf;sdfsd; Will result in this: sdfsdsdf fsdfsddf I have looked into ...
4
votes
2answers
14k views

su options - running command as another user

I was wondering how to run a command as another user from a script. I have the script's owner set as root. I also have the following command being run within the script to run the command as the ...
3
votes
2answers
538 views

Block specific IP from accessing gateway

Suppose you are on linux internet gateway/router. What would you do to block a client with specific IP using bash script. I prefer something like ./block_client.sh 192.168.1.123 to block and ...
3
votes
8answers
719 views

Write a remote managing script

I need to be able to locally run a script that will connect to various servers and run commands on them. What is the best way to accomplish this?
12
votes
7answers
2k views

Practical tasks to learn shell scripting

I'm looking for some common problems in unix system administration and ways that shell scripting can solve them. Completely for self-educational purposes. Also I'd like to know how would you go about ...
2
votes
1answer
2k views

autologin console as root on fedora

Can someone help to autologin in console text mode as root in fedora, usually I can do using script like this : /sbin/autologin.sh: #!/bin/bash 0</dev/$1 1>/dev/$1 2>&1 cat /etc/issue ...
60
votes
5answers
35k 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 ...
8
votes
6answers
787 views

Best way run a command on each file in a directory tree

There appear be a number of ways to do this including loops in shell script, find and xargs. Which of these is best, and which is most portable?
24
votes
7answers
5k views

What Unix commands can be used as a semaphore/lock?

I want to run multiple Bash shell scripts in parallel. However, I want to avoid race conditions. What Unix commands are truly atomic that I could use for this purpose, and how can I use them?
5
votes
1answer
284 views

What is Linux for VMS DCL “ON ERROR”?

Using VMS DCL command scripts one can catch errors by using the on error command: $ on error then goto MyErrorHandler $ directory samiam.txt $ delete x.txt $ exit $MyErrorHandler: $ print ...
2
votes
2answers
1k views

What is Linux for $DECK and $EOD?

In VMS DCL one may embed data in a command file using $DECK and $EOD. What is Linux for this?
162
votes
22answers
90k views

Repeat a Unix command every x seconds forever

There's a builtin 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 ...