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 (3)

1
vote
2answers
11 views

replace a string by variable in a file using bash script

through bash script, I am trying to find a value-number- from a text in a file, then make a new variable then replace it with a string in that file for example. in a file in /root/test.txt , i have a ...
0
votes
0answers
21 views

How to improve bash scripting from 1 long line to a better method? [migrated]

I have a script that open up terminal and open up 5 tabs, execute a certain command, and go to a certain working directory. #!/bin/sh gnome-terminal --tab --title="Zookeeper" --profile Hold -e "sh ...
1
vote
1answer
65 views

How can I make sure a program is killed when VPN is running?

There is a program that I need to not have running whenever my VPN is running. I don't want to resort to closing it manually every time, because I might forget sometime. I would like to guarantee ...
0
votes
1answer
13 views

How to get pulse sound level

I'm using simple keyboard shortcuts to adjust sound level on my fluxbox 123 :Exec amixer sset Master,0 5+ 122 :Exec amixer sset Master,0 5- However I'd like to add some notification (notify-send) ...
-1
votes
3answers
134 views

Print different output in the same csv file

I'm writing a script to analyse some data. I have several subset of files, and I would like to count the line from these files and write the result into a csv file. I'll try to do an example. I have ...
0
votes
0answers
67 views

Color coding the terminal with ANSI R,G,B

My question is where would be an appropriate place to share the below script? r=0 g=0 b=0 while : ; do for ((r=0;r<6;r++)); do color=$((16+36*r+6*g+b)); printf "\033[38;5; ...
2
votes
1answer
15 views

How to make lockout screen script for ubuntu

how to make lockout script for Ubuntu. basically I want to create script and schedule it (cron) and I want computer to lock screen everyday in: 13:00 14:00 16:40 any help would be nice. thanks.
1
vote
1answer
40 views

run startup script which requires a xserver session

I have a python3-script which uses the Gtk-module (imported from gi.repository, for recent-manager functionality), requiring a link to the current xserver session (lightdm service in Ubuntu). Running ...
0
votes
1answer
9 views

Unable to start a cron task as root

I use a program to check raid status. The command is megaclisas-status. Here is the issue : Has user /usr/sbin/megaclisas-status return : This script requires Administrator privs => OK Has root ...
0
votes
1answer
32 views

Odd Illegal Variable Name error in csh script

I have a peculiar problem with a csh script which occurs only in my Lenovo Z500 laptop. I have run the script in 3 other computers with analogous operating systems (Kubuntu 14.04 x64) and the only ...
19
votes
4answers
37k views

What does /dev/null mean in a shell script?

I've started learning bash scripting by using this guide: http://www.tldp.org/LDP/abs/abs-guide.pdf However I got stuck at the first script: cd /var/log cat /dev/null > messages cat /dev/null ...
0
votes
0answers
52 views

error: 'xxx' directory does not exist

I'm trying to compile a file by using the Allwmake command. but i got this error in my terminal : mohsen@mohsen-MS-7599:~$ ...
0
votes
0answers
16 views

Concatenate AVI videos with same format on the command line [duplicate]

I want to create a script to concatenate AVI videos, all with exactly the same format, frame rate and resolution. I don't need any editing, only concatenate all the videos in each of the folders. The ...
0
votes
0answers
28 views

How can I modify this script to only copy certain file types? [on hold]

The script is here: How can I automatically copy the content of a usb (flash) drive to another directory? I would like modify the script to only copy media files (jpg, png, mov, avi, wmv, mp4). ...
3
votes
3answers
88 views

How do I capture a screenshot of a window, and all the windows on top of it?

I'm using screenshots as regression tests for GUI software. Before deploying each new version, a series of automatic tasks is run against the old and the new version, screenshots are generated after ...
4
votes
1answer
2k views

How can I automatically copy the content of a usb (flash) drive to another directory?

I want to program my Ubuntu in such a way that it automatically copies the content of USB flash drive to a defined folder in my home directory. I would like this to be done automatically when any ...
1
vote
2answers
66 views

How to check if script was executed via command line or double-clicked?

How can I determine if a script was invoked from a command line or via double-click in file manager (Nautilis)? If the former, I still have a command prompt when the script finishes, but if it was ...
4
votes
1answer
530 views

What are the differences between executing shell scripts using “source file.sh”, “./file.sh”, “sh file.sh”, “. ./file.sh”?

Have a look at the code: #!/bin/bash read -p "Eneter 1 for UID and 2 for LOGNAME" choice if [ $choice -eq 1 ] then read -p "Enter UID: " uid logname=`cat /etc/passwd | grep $uid | ...
17
votes
4answers
47k views

How do I run a script at start up?

I have a script in a folder: /path/to/my/script.sh I need this script to run every time the system starts (even if no one logs in to the system). What do I need to do in order to make this happen?
3
votes
3answers
314 views

Is there a way to autostart CPULIMIT in order to reduce excessive CPU consumption

tracker-miner-f, tracker-store, tracker-extract and dropbox processes are killing my CPU, they make it run at over 100%, overheating my laptop. I have installed CPULIMIT and it works great ...
0
votes
0answers
30 views

script to move files from downloads to other folder (every time a file goes to the download folder)

My goal is to make an script which prompts up a "save as" windows every time a file falls on the download folder, and allows me to move that file to a selected folder.
1
vote
0answers
10 views

Shell script to create multiple accounts? [duplicate]

I'm looking for some help with a school project which needs a shell script to create 10 accounts (5 teaches and 5 students into different groups) along with respected passwords. I'm a true ubuntu noob ...
1
vote
1answer
132 views

Find duplicates by filemane

I have about 167k files in single folder(for now) and renamed by this script in here: Renaming bunch of files, but only part of the title . How can I find duplicate files by their names (only digits ...
0
votes
1answer
9 views

How to automatically reposition my-weather-indicator desktop widgets for external monitor

My-Weather-Indicator is probably the best weather widget for Ubuntu desktop. However, one needs to manually reposition desktop widgets (e.g. aligned top right) every time an external monitor is ...
-1
votes
2answers
25 views

“syntax error unexpected token fi” when trying to run bash script

I tried to run a script, but I get this error. What does it mean and how can I fix it? # Make the mesh using blockMesh (serial) and decompose it. if [ $runNumber -eq 1 ] cp ...
1
vote
1answer
35 views

How can I make a script autostart after I log into my computer on Ubuntu Mate 15.10?

I'd like to automatically disable the touchpad on my Thinkpad X301 after the system boots up. I can successfully run the script manually, but when I try to execute it by any autostart method, it just ...
0
votes
2answers
87 views

xdotool, open and close Unity Dash on startup

on Ubuntu 14.04 the first Unity Dash search is much slower than the following searches. With xdotool I'm trying to open and then close the Unity Dash user interface on Ubuntu start-up. ...
0
votes
1answer
23 views

mariadb-server syntax error

I am writing a bash script and having trouble with $PASSWORD. Can anyone please tell me the correct way to write sql lines in bash script? QUERY="GRANT ALL PRIVILEGES ON db.* TO 'user'@'localhost' ...
1
vote
0answers
27 views

Thunderbird does not preserve profile's language packs enabled status

I need to access the same Thunderbird profile from both Windows and Ubuntu. On Windows 7, it's Thunderbird version 38 (I think?) whereas the Ubuntu version is 44 (from the thunderbird-next PPA). ...
1
vote
2answers
92 views

How to run a script from terminal [duplicate]

Hi I would like to run a script from the terminal, is there anyway to do that? For example : if I have a python script I would normally run it with this command : python script.py How can I run ...
7
votes
5answers
442 views

Bash - Check directory for files against list of partial file names

I have a server which receives a file per client each day into a directory. The filenames are constructed as follows: uuid_datestring_other-data For example: ...
0
votes
0answers
12 views

How do I find which serial port my Arduino is connected to with a shell script?

I'm writing a little script right now which sends some data to the Arduino through a bash shell script. The command that sends the data looks like this: alias led_green="echo -e -n '\x10' > ...
0
votes
0answers
26 views

How to install a python script as an application

I have been trying to create a deb package for my python script following these steps. My myscript.py contains a simple frame. #!/usr/bin/env python import wx app = wx.App(False) frame = ...
5
votes
1answer
53 views

A sleep script for Ubuntu server

Let's start from the beginning: I have a Pi which wakes up my server when a request comes in on tcpdump, and it works like a treat! My problem is that I want my server to sleep when there is no ...
1
vote
1answer
30 views

Does the 'at' command require a full path to the script's name?

I'm running Ubuntu 14.04 LTS. Sometimes I use the at command to run a Bash script one time like this: at -f goscript 8:00pm (Execs need me to run a report at a time not in crontab.) Is that the ...
0
votes
2answers
43 views

How do I change a variable of a background function?

I have been working on a script for my father that manages several tasks through a script with many functions that chain together (organization purposes). This script relies entirely on zenity for all ...
0
votes
0answers
14 views

Upstart Ruby version issue

I am trying to get Upstart to fire up Sidekiq (https://github.com/mperham/sidekiq/wiki/Deploying-to-Ubuntu). I can manually start it but the same command fails in the Upstart script. I have piped ...
0
votes
1answer
31 views

Bash script not running [duplicate]

So I'm pretty new to ubuntu and I'm trying to make a simple bash script that all it does is running Rubymine so I don't have to write it down in the command line everytime and also so I can have it on ...
1
vote
1answer
240 views

How to autostart a shell script on Ubuntu-touch?

I want to start a shell script on my bq Aquaris E4.5 Ubuntu-Edition whenever I switch on the phone to syncronize my calendar and contacts via syncevolution with my owncloud server. How can I ...
1
vote
0answers
22 views

Archlinux shell script error [closed]

Today I tried to write a .sh file myself. I gave it permisson by doing chmod +x /home/admin/app.sh But when I run it, my chromium closed itself shortly (<100s) and this showed up in the ...
0
votes
0answers
14 views

setpath in .sh script is not working [duplicate]

This is my .sh script. #!/bin/bash export PATH=$PATH:/home/srilm-1.7.1/bin When I am using this script file I could not add the environment variable path for temporary purpose(though the script is ...
2
votes
1answer
100 views

How can I determine if a process has a window, and subsequently show, hide or close it?

Is it possible, either through a shell script or terminal command, assuming you have the PID, determine if it has a main window (form), and then get info about it (title) and show/hide/close it?
1
vote
1answer
44 views

Sudo execute command in Pythonscript

I want to sudo a command from a pythonscript without hardcoding my password in it. The Pythonscript is part of a webservice on Apache2. Since it is part of a webservice, asking the user each time for ...
5
votes
2answers
123 views

Is there a software that periodically lets me do mental arithmetic exercises?

I am aware of my lazy nature and need to push myself towards doing some basic mental arithmetic from time to time. Therefore, I am looking for a software that periodically asks me to do a short mental ...
-1
votes
0answers
22 views

directory creation and ownership [closed]

I have certain directories like backup/data/cm/au and backup/data/cm/Di .Ineed to create the directory path from cm/au and cm/Di in /Tmp.with the same ownership as that of the Orginal directories.I ...
0
votes
0answers
17 views

Bash script: How to concatenate input parameters with strings? [duplicate]

I want to define an alias bak_log which uses an input parameter to backup all files starting with such string I can't find the way to concatenate the input parameter with other strings in order to ...
0
votes
0answers
37 views

Bash script not working with shortcuts

My bash script is working flawless when i call from terminal. However, when i create shortcut to it acts weird. #!/bin/bash url="" function uploadImage { url="$(curl -s -F "file=@$1" ...
0
votes
0answers
13 views

PHP in command line failed : ERROR: memdup failed

After an upgrade to 14.04 LTS, I discovered I have some trouble with PHP. It is impossible to execute maintenance script by command line: [root@xubuntu log]# php ERROR: memdup failed I get ...
33
votes
6answers
61k views

How to run an alias in a shell script?

I have an executable file mpiexec, whose full path is ~/petsc-3.2-p6/petsc-arch/bin/mpiexec. Since I want to execute this command in different directories (without having to retype the entire path), ...
4
votes
1answer
103 views

Moving files with bash scripts

I have a bash script that watches a folder, if something is added to the folder, the script will move all contents withing the monitored folder to the defined destination. I have a few of these ...