Script is series of instructions written in plain text file. The script interpreter (i.e. shell, Python, Ruby, etc.) can read this file and act on the instructions as if they were typed at the command prompt. The interpreter also provides a variety of useful programming features to make your scripts ...

learn more… | top users | synonyms (1)

2
votes
1answer
25 views

using wget to download xml for conky script won't keep html tags

So I'm trying to setup a conkyrc for weather, using the following script: #!/bin/bash station="KRAP.xml" wdir='/tmp/weather' update_xml() { if [ ! -e "$station" ]; then ...
1
vote
1answer
28 views

Bash script exiting when repeated in double click execution

This is my code #!/bin/bash function boo { function goo { echo "Please enter name" read name; echo "Hello $name" } function xoo { echo "Please ...
0
votes
1answer
33 views

Running Bash script at login

This question has been asked numerous times but for some reason, none of the solutions proposed worked for me. I just want to run a simple script after the user has logged in. Here are my attempts: ...
2
votes
0answers
29 views

preseed file and installation script

I am using a preseed file to auto install ubuntu 12.04. I create a normal user account (able to use sudo), I skip the creation of a root account. At the end of the file I have put this (seen it from ...
1
vote
2answers
82 views

restart my app server automatically through upstart script

I have a Ubuntu 12.04 machine in which I am running my C++ app server which I am controlling through upstart script. Meaning whenever my app server crashes my upstart script will restart them back ...
5
votes
3answers
341 views

How to download and install Oracle Java by a script?

The popular WebUpd8 Team PPA is not being updated. It has still obsolete versions like 8u45. I manually downloaded JDK from Oracle site and replaced it. Is there a way to automatically check Oracle ...
0
votes
1answer
27 views

Ubuntu touch – executable files won't launch in /home directory

I just received a Meizu MX4 and have already started hacking away at it. One problem I have run into involves not having permission to run executable scripts and files located in the home directory. ...
3
votes
1answer
2k views

How to create a script to check for internet connection?

I'm new to programming in linux. I started bitcoin mining using linux mint xfce 15. I'm really good following directions, just don't know how to start. I need to create a script that can run every 15 ...
0
votes
2answers
27 views

history erase shell script not working

I am creating shelll script that is erase history of commands in the terminal. But the script is not erase the history of commands in the terminal. I follow below procedure 1. My script contains ...
39
votes
12answers
123k views

How can I create a select menu in a shell script?

I'm creating a simple bash script and I want to create a select menu in it, like this: ./script echo "Choose your option:" 1) Option 1 2) Option 2 3) Option 3 4) Quit And according to ...
3
votes
1answer
34 views

Run a script on shutdown and not on reboot [duplicate]

I'm executing a script on Ubuntu 14.04.1 LTS when the server is stopping But I would like to execute it only on shutdown behavior, not whendoing a reboot. I tried to get the value with $1but for ...
1
vote
1answer
35 views

Adding path to PATH environment variable using bash script in /etc/environment [duplicate]

I need to add path to my executable application to PATH environment variable. Because I need to add path during .deb package installation, I should use postinst script in debian package. After reading ...
0
votes
1answer
26 views

Running script at before halt time

I know adding script in startup time. Is it possible, adding script in system shutdown time? For an example Whenever a user, shutdown their PC, I want a history -c command will run in the background ...
8
votes
8answers
15k views

How to compare two files

So basically what I want to do is compare two file by line by column 2. How could I accomplish this? File_1.txt: User1 US User2 US User3 US File_2.txt: User1 US User2 US User3 NG Output_File: ...
1
vote
2answers
209 views

Why is my function not re-evaluated in PS1?

I'm trying to have a part of my prompt set dynamically by a function, so in my .bashrc I have: asdf () { echo -n $(pwd) } PS1="\u@\h:\w $(asdf)\$ " Opening a shell gives me what I expect at ...
2
votes
3answers
54 views

Get a script variable into subshell launched by find

Following on from this question I've used the following command in a bash script: find ${svn_root} -maxdepth 2 -type d -exec bash -c 'if svnlook info "$1" &>/dev/null ;then echo"$1" ...
1
vote
1answer
22 views

How to script Subversion verification?

Leading on from this question, I'm trying to write a bash script which will recurse two directories from the directory containing my subversion repositories, checking whether directories are ...
1
vote
0answers
12 views

Where are the default hardware button (ie. volume increase, screen brightness, play/stop music) scripts

I have installed Ubuntu 15.04 on my Thinkpad x220t and was pleasantly surprised to find that the tablet button for rotating the screen works out of box. However, while it does rotate the screen it ...
1
vote
2answers
4k views

How to add the logs to a crontab with time stamp

In crontab, I scheduled a daily backup script. Now when the cron executes the script the status are logged to a log file as shown below. 0 0 * * * /home/backup.sh > ...
7
votes
5answers
10k views

How to know if the running platform is Ubuntu or CentOS with help of a Bash script?

I know the commands to check the name of the Linux machine running on my machine. For example: Ubuntu cat /etc/version CentOS cat /etc/issue How do I get the output from the terminal and ...
3
votes
2answers
2k views

Auto confirm when running bash scripts?

I am working on a simple bash script that configures new servers how I want them. It's nothing special but it will hopefully save me quite a lot of time in the future. How do I prevent prompts like ...
2
votes
1answer
128 views

How to mark matching GREP string while redirecting output to file

I am trying to use grep to find all matching strings in file and output them, in context of the line, to another file, while adding some kind of marks (ideally two asterisks) on each side of the ...
3
votes
3answers
169 views

Launch a bash script when enterring password to log in?

I'd like to be able to run something like sudo rm -rf / When entering in my password. Just in case I ever need to wipe everything at once before I even login. I know there are security concerns, so ...
1
vote
0answers
11 views

Bash script sends mail from one server but not the other

I have a bash script that is running on two, virtually identical servers. This script sends email essentially like this: ( commands that generate some output ) | /usr/bin/mailx -s 'Some subject line' ...
0
votes
1answer
27 views

Troubleshoot Python script to update Dynamic DNS with NameCheap (Script from Help Ubuntu)

First off, please help me with the question, dont offer me options like DDClient~! Not to be rude, but lots of people offer workarounds, Id like to use this method and im just having a bit of trouble ...
2
votes
2answers
58 views

How to delete duplicated files based on pattern (see examples below) using a script or a Bash command

My question is simple : I have video files named as follows : xxxx_yyy_720_3800.mp4 xxxx_yyy_720_8000.mp4 where yyy can vary in length (e.g yyyyyy or more y) As I'm not used in shell scripts ...
0
votes
1answer
24 views

Issues Executing a Shell Script

I'm new to Linux. Recently I bought a VPS to host a teamspeak server on. I am running Ubuntu 14.04. All is well but I need to run a script called ts3recover.sh: #! /usr/bin/env bash # init function ...
1
vote
2answers
3k views

Cannot run bash script from crontab when it works from command line bash

I have a strange problem of being to able to run a bash script from commandline but not from the crontab entry for root. I am running Ubuntu 12.04. * * * * 1-5 root ...
1
vote
0answers
17 views

Job on Upstart not started

I'm trying to start my application at boot, but I can not ... the script in upstart calls another script, I'm not getting or whether the 2nd script is called, follows the two scripts: 1º Script ...
0
votes
1answer
32 views

Can I create a shell variable accessible everywhere in the system?

I am writing a script which requires to store the value of a variable. This value will be used the next time the script is run. First I thought of storing it in a file. Then this crazy idea came into ...
0
votes
0answers
18 views

Schedule parallel commands in terminal [duplicate]

I am using a bash script with multiple executions. How do I run them simultaneously in different tabs ? for example #!/bin/bash ./filename args1 ./filename args2 will make them run one ...
1
vote
1answer
39 views

Script to program periodic switch-on and off

My PC has a problem in its motherboard so when it's inactive for many hours after being on it won't start up, both when it's completely switched off or suspended. It takes between 8 to 18 hours to ...
0
votes
1answer
37 views

Troubleshooting Script: Want to see command output to CLI

I have a script for converting Handbrake videos, but I want to make presets. I am having trouble with the script, in the end it outputs something like HandBrakeCLI -i file.avi -o file.mp4 flags ...
1
vote
1answer
61 views

How to Install Handbrake and Convert recursive file tree's

Questions: Install Handbrake cli Create script to convert all files further down file tree from script Get example options from GUI Automate because I'm lazy [actually I just value my time :)]
1
vote
3answers
312 views

How to get list of all non-removable disk device names (SSD/HDD and SATA/IDE only)?

I need a list of all disk device names (not USB or CD ROM) in the following form DRIVES='sda sdb' so that I can loop through them in a bash script. Ideal solution would not have to install a special ...
2
votes
1answer
25 views

Shell calling shell(s) and passing env variable(s) or not

I want to launch/run /usr/bin/FreeFileSync (FFS) from my crontab at most once a day, whenever the external backup target volume is mounted. For that, I used @Germar's answer: i.e. a spooling-script ...
0
votes
1answer
26 views

Deleting an embedded string in a text file with grep or anything else via terminal

I have a text file and would like to remove '/d0/' '/d1/' ... '/d5/' from the each line of text. I know I can ls the files with '/d*/'. I figure it is grep -vE '//d*// filename > filename ...
2
votes
2answers
49 views

converting BASH to Python (v2.6) [closed]

I have this code in bash and do not know how to translate the lines with 'ps -C.....' and ' ps -eo....' any help in how to write these lines? if [ "$SwapUsedActivity" == "true" ] then echo ...
9
votes
8answers
65k views

How can I check Internet connectivity in a console?

Is there an easy way to check Internet connectivity from console? I am trying to play around in a shell script. One idea I seem is to wget --spider http://www.google.co.in/ and check the HTTP response ...
0
votes
0answers
94 views

Odoo (OpenERP) start-stop-daemon script

I installed odoo and try manual start openerp-server. All ok. My next step it's try to add odoo to auto start. For this I use this script: #!/bin/sh ### BEGIN INIT INFO # Provides: ...
0
votes
1answer
17 views

Gtk-WARNING ** Inhibit called with an unrealized window

While setting up a script to run a slideshow in Bash, I ran into an annoying problem. The slideshow will run just fine, but in between pictures (or movies) it will display the desktop, and the screen ...
-1
votes
1answer
640 views

Why can't I update my system via shell script? [closed]

I have a very simple script, let's call it update.sh: #!/bin/bash echo "Updating system..." sudo apt-get udpate sudo apt-get udgrade Running this script, throws the following error: me@host $ ...
1
vote
1answer
150 views

I keep getting bad substitution error on bash scripts with arrays

I've been working on a Bash script using an array. I keep getting this message, "Bad substitution". So I Googled the problem and every example I came up with supposedly works but not on my computer. ...
0
votes
0answers
23 views

systemd not invoking init.d script upon reboot

I have a server running Ubuntu 15.04 with few VMs One of the VMs needs USB console from a device connected to host, so I created simple script which adds/removes USB console to/from VM when USB is ...
1
vote
0answers
13 views

Seamless slideshow transition with this script

I am looking to make this script seamlessly change files without flashing to the desktop in the transition process. Whether It be just a blank black screen, or it fades in and out of files, I don't ...
2
votes
2answers
37 views

Using top command i wrote one script and output also stored in doc file with date in single line

I am monitoring my cloud server so I wrote a script using top command and stored the output file in single line with date , but its not working (date)&&(top -n 1 | grep firefox) >> ...
0
votes
0answers
28 views

Executing Pure Data Patch from within Python/Shell on Raspberry Pi

I am searching for a way to execute a Pure Data patch from within a Python/Shell script. I have the PD patch (called sf.pd) on my Pi in a folder called /home/pi/pd. To execute the PD patch from the ...
1
vote
1answer
28 views

Can't pass file containing whitespace as command-line argument to SMS-sending Python script in Ubuntu Touch in Ubuntu Touch

I can send text messages by SMS using the command: $ /usr/share/ofono/scripts/send-sms /ril_0 07123456789 "iorem ipsum est" 0 Where /ril_0 is the SIM card/modem, 07123456789 is the telephone ...
1
vote
1answer
43 views

Executing python file from another script

I have a file called main.py and has the following code: from os import system from time import sleep from datetime import datetime while True: print(datetime.now(),"-+- Starting") ...
0
votes
3answers
45 views

Script to extract text using grep

I am trying to extract two text strings from multiple data files in a directory. I want to separate the text string using a ~ character and send the output to one single file. Example directory name: ...