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
0answers
11 views

Start a process from (noninteractive) shell script (cgi) and keep it running when script ends

I want a cgi script to start a process which stays alive after the cgi script exits. I tried: #!/bin/bash nohup process-to-keep-running & That works fine, if I run the script from an ...
1
vote
1answer
12 views

shell script for chmod file name but only on new files since last run of the script

i have a directory where new files are uploaded and receive numeric filename as they are uploaded. the file name is numbers that go up. i need to change permissions for the file but only on new files ...
0
votes
0answers
19 views

IPC or command line? [migrated]

I'm creating a nodejs program that need to use some unix command. I have two choices either execute them using exec('command ...') which just execute the command with the given arguments. Or through ...
1
vote
1answer
11 views

LXDE hotkey to start app or switch to it if already running

I got used to Win+(1..9) hotkeys in windows 7+, and would like to implement something like this in LXDE. So, I need to define a hotkey that will: launch defined application if it is not launched ...
3
votes
2answers
64 views

Stop writing to a capture file after it reaches a specific size

I'd like to monitor my network traffic of an specific interface to file. Then I would like to stop the interface if the traffic counts over 60mb total. Is there a possible way to do that?
2
votes
0answers
16 views

How to dynamically control the audio volume based on current decibels

Since the Internet videos have different sound volume levels I am wondering is there a way to dynamically decrease the audio volume if it's above certain decibels to a normal value. Could someone ...
1
vote
1answer
30 views

How to programatically control X11 forwarded apps?

I'd like to set-up X11 Forwarding to run remote X applications on the server and X11 client can handle the UX interaction. However I would like to configure the X11 client or fake it to actual do the ...
0
votes
1answer
29 views

Scanning user directories for specified file [on hold]

i want to find all files in /etc/passwd called cat.sh and then outputs the timestamp and * of entries. I was thinking of using grep -l "cat.sh" * | wc -l
0
votes
1answer
30 views

How to copy files to the timestamp generated directory?

Hello I am trying to copy all files from Documents directory to the backup directory that has a timestamp. So I have created a directory called bk$( the time stamp of the directory) and I am trying to ...
2
votes
1answer
26 views

Dynamic Variable in KornShell Script

This KornShell Script (ksh): envir=Dev eval "${envir}foo=bar" echo "$Devfoo" Output: bar But I will not know what value is assigned to envir variable. So I want to do something like this where ...
0
votes
0answers
78 views

Bash, find and delete old files

Write script for backup files and delete old: #!/bin/sh BACKUPDIR=/var/backups/files ROTATE=1 mkdir -p $BACKUPDIR CURRENT="$BACKUPDIR/`date +%Y-%m-%d`-files.tar.gz" cd /var/ && tar czf ...
1
vote
1answer
70 views

Can I execute a script before every login

I am planning to have a program that will need to connect to a server. I'd like to be able to send a encrypted password to my server. The thing is, I need my decrypting script to be executed ...
2
votes
1answer
43 views

How to create gcov files for a project in a different dir?

I want to analyze code coverage datas. I want to create gcov files from OpenSSL (and from other projects), but I can only create them in the same directory of the project, and only for the files in ...
2
votes
2answers
42 views

Delete Entries in File if the Same Entry Exists in a Master File

I have a JSON master config file whose value may be overwritten by a specific account's config file (also in JSON). The Master file has this structure: { "section1Configs": { "setting01": ...
-1
votes
2answers
47 views

Find file, Edit text within files

Im trying to find a file then edit the text within these files. This is what I have so far, but sadly Im not that well versed... Help Please? grep -rl "wrongtext" ~/Library/Calendars ...
8
votes
7answers
2k views

How can I make a script to count up by fives?

I was trying to make a very simple bash script to list all of the multiples of five between 375 and 3500 (375, 380, 385...). One thing that I tried and didn't work is: for i in {375..3500} do ...
2
votes
2answers
99 views

Merge two-columns files into one file

I have a bunch of files (file1, file2,file3, ...) with two columns. For example, file1 looks like: 0.12 0 0.32 0 0.42 1 0.23 0 and file2 looks like: 0.34 1 0.55 1 0.31 1 0.99 0 I wonder how to ...
3
votes
4answers
387 views

Add path to $PATH if not already in $PATH [duplicate]

I need to add a path in a bash script, but it may be executed several times: export PATH=${OPENSHIFT_HOMEDIR}/app-root/runtime/bin/:${PATH} I don't want that path to be added over and over. How can ...
0
votes
1answer
23 views

Problem with inotify-wait as daemon

I have been running inotify-wait on my ftp server in byobu to monitor a folder, move data, and send email notifications for a few months without problems. Since I started this I have added 3 more ...
0
votes
1answer
58 views

How to execute shell commands in a loop from within a bash script?

I am new to bash and need help badly. I want to write a script which will run on my android phone & perform the following things: echo "1" > /sys/kernel/mm/ksm/run wait for 2 minutes: then ...
-3
votes
0answers
19 views

How to switch 2 scripts based on browser size? [migrated]

I'm new here. I'd like to ask if you can switch 2 scripts using a script? Currently, I have 2 different sizes of banners which are being called using invocation codes. Invocation code for 728x90 ...
1
vote
2answers
37 views

Else not Executing

In my script, I transform data to a more readable format. But I am having an issue. If no arguments are typed, just the script, I want it to come back "Please enter a filename" which I have done. But ...
0
votes
0answers
18 views

Formating VGA info to conky

I'm trying get conky working on my system, and I'm stuck on how to format an specific shell variable to display my VGA. From shell I get my VGA using: lspci | grep VGA The output: 01:00.0 VGA ...
2
votes
1answer
29 views

How to create a zip of directories -mtime -150

I want to zip the directories, sub directories, files in main and sub directories from today till 150 days ago. I only consider the date of the directories where I am running the command, no matter ...
1
vote
0answers
27 views

Can't get bare-bone simple bash function to work [closed]

I have some tmux scripts in a directory, and I'm trying to make a script to make it easier to call them. Function is below tms() { ~/linux/scripts/tmux-scripts/$1 } This is in my bashrc, I then ...
-1
votes
1answer
37 views

How to edit a file from a script using find and replace? [duplicate]

Here is the sample of the code of what my intent is for such a script: #!/bin/bash Update=$1 if [$Update == Value] then NewValue= $Update vi %s/Value/$NewValue/g > Updatedfile fi ...
0
votes
2answers
35 views

Cannot login after making a service autorun at startup [Debian]

On a normal startup after booting the login prompt appears from where I would login. But after making motion autostart I am unable to login or open GUI because motion is using the command line to ...
0
votes
3answers
46 views

Shell append string after last match

I would like to insert a string after the last match, example: String to insert after last instance of banana: Orange Input Apple Banana Apple Banana Output Apple Banana Apple Banana Orange I ...
0
votes
1answer
30 views

Auto Download & Untar Script

Looking to write a script for my Linux Server so look for a specific folder name, then wget a file, and untar. Where would I start with this? I know that it has to be written in bash, but I'm very ...
4
votes
3answers
150 views

Bash script: do something one time inside a loop then stop, but continue looping

I have a Bash script that checks my laptop battery and sends me an Android notification (via shuttle, a Bash script I wrote that serves as a cli interface for the Pushbullet API). It works nicely, but ...
-1
votes
1answer
43 views

Whats wrong with the 2nd script?

I am new to linux and scripting. I have some concerns regarding the script below which creates folder per line from file. Folder.list is located in /scripts/ . 1st script works smoothly but the 2nd ...
2
votes
0answers
22 views

How can I tell whether or not I am in a text area?

I am running a Window Manager and am soon getting a Thinkpad x220 tablet. I was hoping to make the tablet a little more functional by having an on-screen keyboard, and I have set it up so I can ...
0
votes
1answer
52 views

How to find out last run time of shell script?

I am trying to find out at what time the shell script ran last time within the shell script. I tried: ls -laru ls -lart but all these commands give me the last modified time and last accessed ...
0
votes
4answers
59 views

Copying Only Directories With Files

I am trying to copy files and the directory it is in to another location. I can find the path like this: find ~/dim_import/* -type f ! -name xdir | cut -d '/' -f 5-10 which outputs ...
1
vote
1answer
57 views

sh - Using Arguments in .profile functions

I want to use an argument in the function I created in my .profile file. I want to ask for input if no argument is given, otherwise set a variable to $1. When I check $1 to see if it is empty, I ...
0
votes
1answer
46 views

How to calculate Swap warning/critical dynamically through script?

I have used SAR in my below script and is trying to run on individual servers for my nagios monitoring. Can someone please suggest how i can get the swap warning and swap critical values in my check ...
1
vote
2answers
78 views

How do I scp a file from server A to server B from cron?

I have a file in server A which I am able to do transfer to server B using scp. I need to do this through a cron entry. server B has a password. How do I perform this?
0
votes
1answer
51 views

Select latest updated file from directory and send it via email

I want to select latest error(timestamp).log file from some directory and send it via email as attachment. What I am trying is: Filename: abc.sh echo 'An error occured' | mutt -s "Logs" -a ...
1
vote
2answers
227 views

Bash script to read file and echo different lines to output files [duplicate]

I have a log.txt file with various lines of strings and information. I want to write a script to read the log.txt file line by line and any line that contains the word debug I want to put that line ...
0
votes
1answer
52 views

/bin/sh script error “arithmetic expression: expecting primary: ” + “ ”

ERROR: ./client-disconnect.sh: 22: ./client-disconnect.sh: arithmetic expression: expecting primary: " + " I just need to know how to fix it. It's for user accounting with OpenVPN. Script ...
1
vote
1answer
24 views

What's the Fedora equivalent of /var/lib/dpkg/info/[…].prerm?

Example file: /var/lib/dpkg/info/util-linux.prerm What's the Fedora equivalent of this file? (Not limited to util-linux - generic question for any package.) Use case: A prerm script is failing. ...
-3
votes
1answer
26 views

Need help running a command based on a file in the directory

I have some scripts setup that I would like a master script to call based on a files appearance in a directory. Basically I have what's show below. Script A uses file a Script B uses file b ...
1
vote
0answers
32 views

Script for changing monitor refresh rate when fullscreen on a specific website.

Premise I recently discovered this website where I can watch legal streaming of plenty of animes. They use a flash player and the CEO said that, for legal reasons, they can't use a HTML5 player. The ...
1
vote
0answers
23 views

-devilspie doesn't play nice with spawning new terminals

I'm trying to configure devilspie so that on detection of opening a certain directory it runs a script to mount that directory over a network. I don't think the script itself is too important but ...
2
votes
3answers
56 views

Split command and arguments, and put into variable in a bash script

I have a script that repeats the same (very long) grep command many times. I want to make the script more readable by cutting the line length, so I tried to put parts of the command into variables. ...
1
vote
0answers
19 views

Creating and mounting partition automtically

I am running raspberry pi on raspbian wheezy, and I'd like to create script that automatically creates new partition on unused area of disk and mountpoints on it so it'll always mount on same ...
0
votes
2answers
54 views

viewing printf after pipe (or subshell?)

Ok, this is hard to distill to a single question because it really depends on how I'm going to troubleshoot it. The following script is meant to pipe mount.cifs commands to a while loop that enters ...
4
votes
3answers
357 views

Exiting a shell script with nested loops

I have a shell script with nested loops and just found out that "exit" doesn't really exit the script, but only the current loop. Is there another way to completely exit the script on a certain error ...
1
vote
0answers
10 views

Application started in /etc/X11/xdm/Xsetup can't receive key presses

I'm using xdm (and I'd like to keep it that way) for a project and I need a terminal to run a script before the login prompt. The script requires some user input, however, it doesn't seem to work. ...
0
votes
2answers
45 views

Why Are There Three Processing Running For One Script?

I have the following line in crontab. @reboot /usr/bin/teamspeak3-server_linux-amd64/ts3server_minimal_runscript.sh When I reboot, the script runs (i.e. my Teamspeak 3 server starts) in the ...