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)

0
votes
1answer
37 views

Editing the variable PATH

I want to start script just by typing script not the full path of the script for example ~/Desktop/name/script so i tried to edit variable PATH PATH="$PATH:~/Desktop/name" in the name folder i have ...
0
votes
1answer
34 views

command line in su - and background

I am writing a simple unix script to automate reading of a log file. The following does not give any output to the terminal. It just asks for the password for buser and then it just hangs. I ...
0
votes
2answers
46 views

How to use two ssh comands in the same script and then continue executing other commands?

To login into my database the following are the steps I follow every time: ssh unix_id@something.com password: Once I am connected, I log in into a local database server in the same terminal: ...
1
vote
1answer
21 views

alsa config for startup

I'm having a problem with my headphone. A friendly person over at the #alsa irc channel came up with this to rectify: sudo hda-verb /dev/snd/hwC0D0 0x15 SET_EAPD_BTLENABLE 2 However it has to be ...
0
votes
1answer
53 views

Understanding scriptreplay timing file

I am trying to understand the timing files produced by the script command (which are supposed to be read by scriptreplay while running typescript files). The timing file is always made of two columns, ...
4
votes
5answers
207 views

How shrink test -eq expression with more than one var value in /bin/sh

#!/bin/sh if [ $num -eq 9 -o $num -eq 75 -o $num -eq 200 ]; then echo "do this" elif [ $num -eq 40 -o $num -eq 53 -o $num -eq 63]; then echo "do something for this" else echo "for other do ...
1
vote
2answers
66 views

Copy Files Based on Dates in Filename

I am having an issue when attempting to copy a range files from one directory to another based upon a date contained within the filename. The date in the filename is in UTC whereas the created dates ...
3
votes
2answers
71 views

How call a function inside another function

I'm working actually in a shell script to monitor a server resources. I have a function and I want to know how can I call a second function inside the main one. Example: funct mainfunct(){ echo "...
0
votes
1answer
52 views

yad, how to create a simple question dialog?

I know yad can do much more than zenity, but it also misses quickies like --question. What is the simplest way to mimic that zenity option on yad? Obs.: mimic quickies for other possibly missing ...
3
votes
1answer
42 views

Sourcing .bashrc from ssh after removing the prompt string check

I have a .bashrc file that needs to be sourced non-interactively. The problem is that on the file there is this return statement preventing from sourcing by code: [ -z "$PS1" ] && return ...
0
votes
1answer
39 views

Checking for mails

I recently started using mails via UNIX. I would like to create a script , that would write (every time I log in ) something like "The content of your mailbox has changed since last checkup" ...
-3
votes
3answers
94 views

How can I check that two input values are correct in a bash script?

I am writing a bash script and want to add some simple validation tests. The input should be either 1 or 2 and the script should ask for input again until the correct input is given. I was thinking ...
-1
votes
1answer
39 views

Need some support on Python for string append/replacement

I am writing a python script to replace/append certain strings with their equivalents.. Actual string: Name = "com.icon.t2p" Object = "/com/icon/t2p/host" Expected Output : Name = "com.icon....
0
votes
2answers
55 views

exit code of the command **before** last? [duplicate]

I'm running a script within a script, release.sh and caller.sh (caller.sh calls release.sh). Both are bash. release.sh contains a bunch of conditions with 'exit 1' for errors. caller.sh contains a ...
1
vote
2answers
43 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 /var/...
-3
votes
4answers
101 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
67 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 ro.build....
0
votes
2answers
87 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
46 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 /etc/usbmount/mount.d/...
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
29 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
37 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; idx=$...
1
vote
0answers
29 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
41 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
42 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
78 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
29 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
68 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
64 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
62 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
49 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
88 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 ="; WA_PORT=...
0
votes
1answer
32 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
83 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 apresv/...
3
votes
2answers
273 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
107 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
64 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
33 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
97 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
106 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
139 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
106 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
25 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 -> ...