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)

2
votes
1answer
947 views

Is there a shell utility for printing the contents of a plist? Preferably for a jailbroken iOS device?

I need a tool that prints the actual text in a plist file (plutil changes the format, cat prints gibberish, and there is no defaults command for iOS). It needs to be in a script, so text editors don't ...
4
votes
3answers
1k views

command line audio with mpg123 - how to save position in audio and begin from that location next time?

I am contemplating using mpg123 as an audiobook player. I can't find any other good audiobook players for Linux, and I think mpg123 may be my best option. My audiobooks are organized by directories ...
3
votes
3answers
4k views

using stat to provide timestamp for touch

Am trying to OCR some documents insitu (from a linux command line on a windows share). The process of OCRing is find and I have muddled through using the find command to pipe the files through the ...
4
votes
3answers
756 views

What does the following Bash script mean/do?

What does the following script mean? exec 4<&0 0</etc/XX/cfg read line1 exec 0<&4 UPDATE Thanks for the answer, just one part I'm not sure: It redirects fd0 to fd4, and ...
2
votes
2answers
223 views

Verify if a system has DVD burners?

Is it possible to verify if the system has a DVD burner installed? I need this for a script.
3
votes
1answer
693 views

Export a m3u playlist to a directory in order they appear in the playlist

There is a way to rsync a m3u playlist into a destination directory. How can I process the list and number the output so it orders the files to match the playlist order? For example the m3u: ...
3
votes
2answers
2k views

How can I force a bash loop to end if it runs x times in x seconds?

I'm trying to grab batches of input from a remote pipe via ssh. My script below works ok, but I would like to add some sort of check into it so that if something were to go wrong or break the loop ...
9
votes
6answers
903 views

Text Manipulation Across multiple lines

I Have a file that has text like this: AAAA BBBB CCCC DDDD 1234 5678 9012 3456 EEEE 7890 etc... And i want to match up the Alphabetic lines with the Numeric lines so they are like this: ...
2
votes
2answers
1k views

LVM2: Obtaining lv and vg names from path (volume group name and logical volume name)

Let's assume we have lv path: lvpath=/dev/mapper/vg2-Music Than I split lvdisplay -c with cut: vgname="$(lvdisplay -c "$lvpath" | cut -d ':' -f 2 )" lvname="$(basename "$(lvdisplay -c "$lvpath" | ...
4
votes
2answers
567 views

List of script( location)s that get run automatically, and when?

Does anybody know (of a resource listing) what scripts are run automatically, and when, from the moment I startup the computer until it's shutdown again. I know several places where I can add scripts ...
4
votes
4answers
6k views

Backup of LVM2 logical volume

I'd like to make backup on external drive of LVM2 logical volume in dd manner. Approach I consider is to make lv on extranl drive with identical size copy with dd (Please let me know if you see ...
1
vote
1answer
2k views

Run expect inside a bash script as another user

I am writing a bash script to install some small software I'm developing. That script is run with sudo (as root), but some of the commands that are executed by the script need (or should be) run with ...
0
votes
2answers
258 views

How to generate Zipf-like samples, by using scripting language

Is there any scripting language function (like in python or bash) that samples from a zipf-like distribution, for exponent 0<a<=1. PS: I am aware of existence of a numpy function that can ...
3
votes
2answers
4k views

Sed: replacing digits

I am trying to write some install scripts for when I install/upgrade Ubuntu. I'm having trouble with fixing logrotate.d: /var/log/ufw.log { rotate 7 weekly missingok notifempty compress delaycompress ...
0
votes
2answers
1k views

Need help to make rows into column with awk or sed

Recently, I look for scripts to take this: This; Is; First; Line; and make it like: This Is First Line
4
votes
6answers
3k views

Linux script or program to shorten filenames

I haven't had much success in finding a Linux version of namemangler, which I need to rename 1000 of files so they are readable on Windows. Does anyone know of a Linux program that can do this? If ...
3
votes
1answer
329 views

Labeling/Aliasing multiple network addresses

If my machine is connected to several networks and configured with multiple addresses (ipv4), is it wise to configure and use labels to identify them ? By labels I mean the iproute2 ip command's ...
6
votes
1answer
355 views

Is it possible to write portable service scripts to control a daemon?

I (or one of my colleagues) need to write one or more shell scripts to control the execution of a daemon. We need to be able to start the daemon, tell it to gracefully shut down, and force a shutdown. ...
4
votes
3answers
344 views

Converting a history to a script?

Often times I've typed in a bunch of commands when I realize that I am going to keep typing them in and that I would really like a script. Now I understand that no matter how I save my history, I am ...
1
vote
1answer
70 views

Is S25mdadm start script priority correct?

(On Ubuntu 11.10 - configuration inherited from 10.10) Occasionally the boot process seems to suffer a race condition where a starting process misses some of the Raid-1 FSes, build via mdadm. ...
3
votes
1answer
658 views

Change screen “hardstatus” color dynamically

I show the hard-disk free space in hardstatus screen. But also I want change the color of this value when it's less than a value to alert me. I have done a script that it checks this and it returns a ...
0
votes
2answers
1k views

How to calculate in linux number of file inside nested directories?

I need to extract information how much files are in some directory tree: /.../testRoot/test1/test11/..../file1 /.../testRoot/test1/test11/file2 /.../testRoot/test1/test11/..../file3 ...
-1
votes
2answers
241 views

Shell programming temp=$1 vs temp=1

What's the difference between temp=$1 and temp=1? Why do I need the dollar sign? For example: #!/bin/bash temp=$1 cell=$((($temp-32)*5/9)) echo $cell
5
votes
1answer
2k views

Execute Script automatically at shutdown on Fedora 15/16

With fedora 15 or 16, I don't find the directory for execute a shell script automaticaly at shutdown...
1
vote
1answer
317 views

selective stdout , stderr and logging using the script command [duplicate]

Possible Duplicate: Show only stderr on screen but write both stdout and stderr to file stdout , stderr and logging using the script command cat test.sh: rm -v foo.tmp date pwd cat ...
0
votes
2answers
244 views

Autentification on SSH connection in OneLine [duplicate]

Possible Duplicate: Shell Script for logging into a ssh server I need to connect via SSH to a remote server, however I must do this with out interactive mode and with out use Public keys ...
0
votes
1answer
887 views

Why isn't /etc/rc.local executed when I log in?

I'm trying to run a script at login, and this is the way I've found to do it. I'ved edited /etc/rc.local with a line such as bash /home/me/script.sh. I've made that script executable. It doesn't ...
1
vote
2answers
919 views

Issue with mv command in a script

This must be a very simple issue to solve, but I am stuck (not a UNIX pro). I need to move a gz to a target directory, but I get a No such file or directory. NOW=$(date +"%Y-%m-%d-%T") ...
3
votes
1answer
700 views

merging files and getting column values based on id field

bash-3.2$ cat sample.log sample.log.1 sample.log.2 ID COL1 COL2 COL4 1 col1 col2 col4 2 c1 c2 c4 3 co1 co2 co4 ID COL3 COL1 1 col3 col1 2 c3 c1 3 co3 co1 ID COL1 COL2 COL3 1 col1 ...
9
votes
3answers
701 views

How to pipe the list of commands displayed by of “tab complete”?

When using commands in bash I like the double tab option to display the available commands. Some commands have more possible matches than others: Is there a way I can pipe the output of the double ...
8
votes
1answer
444 views

Command to move a window to all desktops

I'd like to be able to move (pin) an existing window to all desktops using a scriptable command, rather than through the window menu. wmctrl -r <WIN> -t <DESK> will move a window to a ...
1
vote
2answers
314 views

$2 (field reference) in awk BEGIN is not working

In the following snippet, $2 in awk is returning empty. What am I doing wrong? I am trying to find the difference between MAX and MIN. #!/bin/ksh if [ $# -ne 1 ]; then echo "Usage: sh ...
4
votes
4answers
319 views

Generating sets of files that fit on a given media size for tar -T

Can anyone suggest a script that will take as input the name of one or more directories and a media size, and output lists of files for input to tar using -T (assuming no compression)? ...
5
votes
1answer
300 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

Invert results for “for in * do”-loops [duplicate]

Possible Duplicate: How do I reverse a for loop? Is there an easy way to invert a for in loop? For a script I want to process files in their reverse order. So instead of: for file in ...
3
votes
4answers
2k views

passing passwords to a script

I want to scp a file to a remote host, and from there, run a command on the file, and exit the remote session. If I write a usual script, call scp and then ssh, I am prompted to enter two passwords. ...
4
votes
1answer
404 views

Efficient way of comparing in awk

#!/bin/awk BEGIN { while(getline var < compareTo > 0) { orderIds[var]=var; } } { if(orderIds[$0] == "") { print $0; ...
0
votes
3answers
217 views

help with script; if status is this do that if not do something else

I need to write a script that checks on the status of something. If the status "Copying" then exit (or retry in 60 minutes if we want to get fancy.) If all there is nothing returned (based on my ...
3
votes
1answer
418 views

An efficient filter for .sql files with just “INSERT INTO”

Several times I've found myself working on data that has been exported to .sql files that I want to process rather than import into a database. I'm only talking about "pure data" sql files. Ones that ...
7
votes
2answers
1k views

sync files recursively between two folders where files are less than 24 hours old

I want to find all the files under a directory which are within 24 hours then rsync those files with another server. There are some old files that I do not want to transfer, however if those old ...
1
vote
3answers
354 views

ksh cannot cp from location with space in it?

I am trying to do the following in ksh but keep getting cannot stat message for the cp command: JMX_ROOT=/bfs-build/build-info/mep_mainline-Linux.latest/core/mainline/automation ...
3
votes
1answer
1k views

How to use a value returned by a script in grep filter?

I'm on FreeBSD's csh. I want to form a row with domains of one user and then use this row to filter exim maillog to get only mail from/to this user's domains. I wrote a script to form a row from a ...
3
votes
3answers
201 views

Permissions for a submission script

I'm a TA for an introductory Python programming class (all work is done from the terminal), and I'm writing a project submission script. Ideally I want a directory setup like this: submissions/ ...
5
votes
1answer
567 views

Giving a custom script root permissions

I have a backup drive that is Truecrypt Encrypted. I'd like to automnt this drive so I can automate backups when in the office. I am using Linux Mint 12 x64bit I wrote a script that runs successfully ...
3
votes
3answers
434 views

How to make svn look for if there is an update once a minute and if there is call some script?

I am developing a server app. I have a remote machine with Debian that I use for testing. Currently I update the server manually when each new svn version comes out. It is just a testing server and ...
5
votes
3answers
1k views

Keep running a script via ssh

ssh can use to run remote commands. ssh me@server.com 'long-script.sh' I run a long script that will take a lot of time, but I want to close my computer and keep running the script in the remote ...
1
vote
3answers
84 views

What are the proper tools to setup a remote compilation and running (something like ideone)?

I'm trying to achieve similar functionality in a server for community programming and I've drafted this to wrap up another take on oneide's functions: From a Perl CGI I build a script like this (not ...
0
votes
2answers
292 views

Creating SSH Terminal Wrapper

I'm new to scripting, but somewhat familiar with Linux. I am actually using this on a Fedora16 build, with Gnome3 and gnome-terminal... fyi. I flip through all sorts of ssh terminals all day long ...
3
votes
3answers
2k views

How do I run a script n times at same time and how do I simulate a semaphore?

I have a text file, inside of this file is a number, and I have a script.sh in ksh. The script reads the file and gets the number, then increases the number by 1 and overwrites the new number in the ...
3
votes
3answers
284 views

bash function to find a directory recursively

How can I write a bash-function that finds a specific parent directory. Here's my setup: /home/user/dev/project1/branch1/deeply/nested/module/structure The app-server used for devs is located at: ...