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
109 views

Systemd vs rc.local for a startup script post installation? (completely hands free)

I have a custom Ubuntu Server ISO that answers installation questions via preseed and kickstart files. It also installs additional .debs I've placed on the ISO during the actual installation as well. ...
0
votes
0answers
31 views

How to add a new inittab entry - a script

vi /etc/inittab startfoobar:3:respawn:/root/startfoobar.sh # added this line telinit q But the /root/startfoobar.sh doesn't starts. Why? SLES 11. What am I missing? cat /root/startfoobar.sh sleep ...
1
vote
1answer
41 views

deny use of multiple getopts arguments

I'm trying to figure out a way to deny the usage of more than one getopts args in a certain situation. Say we have something like this: while getopts "a:b:c:def" variable; do case $variable in a)a=$...
-1
votes
1answer
47 views

How to check if a directory exists I don't know the exact name of it with a bash script

I need to check if a directory already exists, in this case the one with a number suffix, and I won't know the exact number. Example directories to search: /usr/ names names.backup names.20160316 [...
1
vote
3answers
178 views

shell scripting with large amount of files - timelapse

I have created a shell script to capture images every minutes on my raspberry pi. I think something is not quite right as it has been taking pictures but not saves them. I wonder if someone could just ...
0
votes
1answer
34 views

Bug in shell script for printing the tree-like structure of the curent diretcory

I have wrote the following script: #!/bin/bash if [ $# -eq 0 ] then read current_dir else current_dir=$1 fi function print_tree_representation () { for file in `ls -A $1` do ...
1
vote
1answer
55 views

Update apt-get cache only if it's older than certain time

I'm on debian. I would like to execute an apt-get update (and maybe something else) only if the time since last update is bigger or smaller than a certain amount with a straight command, no cron ...
0
votes
2answers
121 views

What's the best way to edit a file with a bash script?

Using /bin/bash on RHEL 5.8 and I want to automate editing a file. I need the script to search the file and replace a line in the file. Line example: Other line Current date 01121990 Other line ...
0
votes
0answers
12 views

Linking and combining text from different documents into dynamic document

I am taking notes on many, related topics from multiple sources. For instance, one of the sources is a textbook on machine learning. I type the notes in an .odt document (but whatever, it could be ....
0
votes
1answer
38 views

My if bash script always execute the break

I`m making a script to rename files in a folder. The new name for the files is in a config file. I have to be sure that the file I want to rename corresponds to the current one in the config file. My ...
1
vote
2answers
75 views

Change Directory and execute command automatically then change directory back out

I'm attempting to write a script that will be run in a given directory with many single level sub directories. The script will cd into each of the sub directories, execute a command on the files in ...
0
votes
2answers
70 views

If filename has more than n characters, delete the last ones

I'm kinda new with the unix shell, and I don't seem to find the answer of my problem : I have a folder containing multiple files : a correct filename contains exactly 13 characters (numbers + letters ...
0
votes
0answers
29 views

How to move a postgresql backup dump to an other server with a script?

I have on a ubuntu 14.04 Server some Backup Files from a PostgreSQL Database. How Can I move this with a daily backup script to an other server? I need a script that moves my files in path /example/...
-4
votes
2answers
62 views

get the input from a script and echo it to another file

I have a python script that create some files and it ask me to enter a password this script is called from bash script is their any way to get the entered password and echo it to text file
-1
votes
2answers
39 views

Why would a user not be able to delete a file they created

Reposting the question about deleting a file. We have a script that is used to transfer files between two SCO Unix systems. The script has been rock solid for years. Recently the firewall unit at ...
0
votes
2answers
212 views

How to output some data to different cells of an Excel File?

Example: I have a file that has following data: cvrta2100 Error 404 Fixed cvrta2111 Licensed Needs Fixing cvrta2123 Error 404 Fixed cvrta2333 Licensed Needs Fixing I am using awk to print ...
0
votes
0answers
31 views

Simple xdotool UI automation login script in Debian 8 VM on Windows 10 host doesn't work when VM starts for first time after Windows BSOD

I do time-lapses with computer scanners using VueScan in Debian 8 VMs using VMware on a Windows 10 host workstation. I made a script that runs when the VMs start up that mounts a Windows network share,...
3
votes
2answers
53 views

Searching /usr/dict/words to find words with certain properties

I would like to write a script to search through /usr/dict/words to find all words that meet some criteria I specify. For example, finding all palindromic words (like "racecar", "madam", etc.) or ...
1
vote
1answer
57 views

Execute an online script gracefully

Context I've set up a site to post scripts to which I can then execute later using the following command: curl -so /tmp/script http://scripts.programster.org/scripts/1?output=raw && . /tmp/...
0
votes
0answers
38 views

Boot portable linux image and auto run script from bootable usb

So I was wondering of the if there was anyway for be to boot up a portable linux OS and have it autorun a script after it loads up. I was hoping to use something simple such as TinyCoreLinux or ...
1
vote
2answers
79 views

Wait until gnome-terminal ends

I'm trying to implement a script who runs four terminal window in parallel using this function gnome-terminal -e sh -c "python scraper.py". I would like to know if there's a way to wait until each ...
0
votes
0answers
16 views

journald 'forgets' correct unit name for shell-based units?

With a unit file like this one here, and an (exectuable, with shebang) shell script as named: [Service] Type=oneshot ExecStart=/some/shell/script.sh I get journal output like this: Mar 10 17:11:27 ...
0
votes
0answers
30 views

How to check the status of the latest aide run after login, and test if it's done less then 24h(green) or more then 48h(red)?

-Green: No changes detected and last AIDE run was less then 24 hours ago -Red: Changes detected or last run was 2 days ago I tried to grep the timestamp from the log file /var/log/aide/aide.log which ...
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
38 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
47 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
24 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
65 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
213 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
67 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
85 views

How call a function inside another function

I'm working actually in a shell script to monitor a server's 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
56 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
44 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
40 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
96 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
41 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
57 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
45 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
107 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
69 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
101 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
62 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
50 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
64 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
45 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
38 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=$...