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

0
votes
0answers
22 views

Merge two files - use the first column as key

I am trying to get the bandwidth of the domain from one file and their Hits details from my other file. The format of the two files is like follows: 1) bandwidth.txt aadrivingschool.ws ...
0
votes
1answer
17 views

Loop trough all folders recursively end execute make command when Makefile present

I really suck in bash scripting, so i'm hoping on your help guys. I need a script which will loop trough all folders, sub folders, sub sub folders, etc. inside folder /home/work and if there is ...
1
vote
1answer
32 views

Get a list of all scripts and their paths which are run as cron job

I am looking for some script or terminal command to list all the scripts (preferably with their paths) which are run on a periodic basis by cron, cron.daily, anacron. I am not looking for any filter ...
2
votes
1answer
20 views

How do I get my script to run BEFORE any shutdown sequence like unmounting my external drive

I have a back up script in ~/scripts/backup.sh and my upstart conf in ~/.config/upstart/shutdown.conf. description "my shutdown script" start on desktop-end task console log script exec ...
7
votes
4answers
642 views

How to write a script which works with or without arguments?

I have a bash script which goes something like this: #!/bin/bash if [ $1 = "--test" ] || [ $1 = "-t" ]; then echo "Testing..." testing="y" else testing="n" echo "Not testing." fi ...
8
votes
5answers
532 views

How to detect the number of opened terminals by the user

I am using Ubuntu and can manually change the bash shell prompt color to green using export PS1="\e[0;32m[\u@\h \W]\$ \e[m" However, I want the shell prompt color to automatically change whenever ...
2
votes
0answers
22 views

How to find the last valid information possibly spread over several log files

I have a fleet of busses that send me a monitoring log file every morning regarding the status of the vehicle the previous day. The log updates various information every 5 minutes. Among the data ...
0
votes
2answers
39 views

Stop apt-get autoremove from removing old kernel?

I like managing kernels my self, and I can't figure how to stop apt-get autoremove from deleting older kernels.
0
votes
1answer
15 views

Shell Script Won't Run

Newbie. I am trying to install BeautifulSoup4. There is a shell script "convert-py3k" to run, to convert to Python 3 version. It has an executable permission but, neither double clicking nor, ...
0
votes
0answers
7 views

Upstart 1.12.1 only running first exec

file /etc/init/karl-startup-sensei-init.conf: description "something" author "karl" start on runlevel [2345] script exec echo `date` /etc/init/karl-startup-sensei-init.conf - starting >> ...
0
votes
1answer
19 views

Running two scripts on profile login (bash & sudo bash)

I have two scripts which I would like to be run when I log into my profile. ~/.scripts/startup/user-sensei-raw-startup.sh: ids=$(xinput list | awk '/SteelSeries Sensei Raw Gaming Mouse .*pointer/ ...
0
votes
0answers
17 views

xfce create Launcher for .sh with parameters

Im trying to create a launcher but I never worked with a desktop environment before. The file is placed at /home/Teamspeak3/ts3server_startscript.sh and needs the parameter start to run. I've ...
27
votes
9answers
89k views

How to start Virtual box machines automatically when booting?

I have many Virtual box machines in my Ubuntu12.04, each time i shutdown or reboot i have to start them one by one. I wanna a help in writing script for automatically autostart the VBox machines ...
0
votes
1answer
23 views

Can (or should) a script perform a login?

I have a nightly process that SFTPs files from a Windows server to our Unbuntu server (12.04.5 LTS) using my username and login. A script is setup via cron (sudo crontab -e) runs later to copy those ...
1
vote
1answer
24 views

How to Integrate Dropbox in Thunar?

How can I integrate Dropbox into Thunar? I am using Xubuntu 14.04 with Xfce 4.12 installed via PPA, and thunar-dropbox-plugin has been broken. I have also heard that it is not working on Xubuntu ...
0
votes
0answers
25 views

Custom script not working as expected in ubuntu [duplicate]

I wrote a java application, want to register it as a service, so wrote a bash script in /etc/init.d/. Here is the script: #!/bin/sh # # chkconfig: 345 50 83 # ### BEGIN INIT INFO # Short ...
0
votes
0answers
29 views

Crontab - export DISPLAY=:0.0 or .sh script won't run

I have written a basic script to familiarize myself with crontab that changes my wallpaper every minute with one random image from a set folder: #! /bin/bash ...
7
votes
1answer
749 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 | ...
1
vote
1answer
11 views

Does rng-tools run at startup?

I installed rng-tools and noticed that is has a script in /etc/init.d. Does that mean that it will run at boot? Or do I still have to run rngd -r /etc/random or /etc/init.d/rng-tools start?
0
votes
1answer
19 views

Scan from scanner and directly print to another printer (2 devices)

I have a Canon PIXMA MFP that can duplex scan a stack with its document feeder. I have a separate Brother Duplex Laserprinter. The Canon is over WiFi and can scan easily with the Simple Scan ...
0
votes
0answers
53 views

Can't execute .sh file that works finely through the terminal in Xubuntu 16.04

My first attempt with scripts, is a shortcut to open a Jupyter Notebook on a specified folder from an file on the Desktop called ipython.sh. The content of ipython.sh is: #!/bin/bash cd ~ ...
1
vote
1answer
19 views

How could one export from a sourced script only specific functions

I try to expose from a script only specific functions. For example, let's say I have the script hello_world.sh and it has 2 functions, hello and world: ## hello_world.sh - name of the file, not the ...
0
votes
0answers
17 views

run script on a remote machine

I'd like to run my script on a remote machine. I have a bunch of scripts,so I'd like to use source command in main file. How I can do that? Is this possible or not? My main file script: source ...
0
votes
0answers
42 views

I have a problem with a loop in a script. How I can create a loop in a loop?

I'm doing a script for improving my scripting capacities, but I can't make a loop work, how I can fix it? Here's the script: As far as my knowledge go, the problem is in the below script: read op2; ...
1
vote
2answers
187 views

nmap in a shell script : some issues

I decided to make a shell script for basic nmap scanning so I did it like this : #!/bin/bash sudo apt-get install nmap printf "enter the name of site to do basic scan on >>>" read NAME ...
1
vote
0answers
33 views

Launch python script fullscreen on startup (Ubuntu 14.04)

I have a python program that I would like to automatically run after logging in. This shouldn't be much of a problem, however, I would like the terminal to be in fullscreen mode while running the ...
0
votes
2answers
27 views

execute a file having some terminal commands [duplicate]

I want to create a file which contains some commands (suppose 4 commands) such that when I click on that file, the commands will executed in terminal. Is it possible ? I am using Ubuntu 14.04 LTS. ...
11
votes
6answers
44k views

How to check the process is already running or not

I want to check the particular process in already running or not. I refereed this Q&A. But I didn't get any specific solution. Following is the example that I tried: I have created abc.sh file ...
0
votes
0answers
22 views

Gammu runonreceive doesn't pass variable

i want to configure my Rapsberry as a SMS Ping Pong Player. So i installed gammu-smsd and configured the gammu-smsdrc as follows: # Configuration file for Gammu SMS Daemon # Gammu library ...
7
votes
5answers
38k views

Is it possible to pass passwords on a shell script?

Long time i am searching for this, i would like to know is it possible to pass passwords in a shell script? Many of the answers returned with no. Recently i read an article stating that how to pass ...
0
votes
1answer
30 views

bash storing array variables in rotation

My objective is store values in array , as below: arr[0]=apple arr[1]=banana arr[2]=orange arr[3]=grapes arr[4]=apple arr[5]=banana arr[6]=orange arr[7]=grapes arr[8]=apple arr[9]=banana I can ...
1
vote
3answers
83 views

How can I automatically try a specific resolution if I connect an (any) external monitor?

Is there any way to configure Ubuntu to set default "first-try" monitor resolution whenever a (or two) monitor plugged in. Regardless of what graphic cards or graphic driver that being used. For ...
15
votes
2answers
16k views

Execute a script upon logout/reboot/shutdown in Ubuntu

I'd like to run a .sh file using bash on logout and shutdown of Ubuntu. I have searched up and down the web and have found only fixes for KDE and GNOME. The script is simple, I just need to know if I ...
6
votes
3answers
738 views

A script for copying random folders

I'd like to realize a little project I've always had in mind. I have a vast music library on my desktop and I'm looking for a way/script to select a random amount of folders (say, 25 albums) and, if ...
1
vote
1answer
13 views

How to restart gnome shell but daemonise it from a script? [duplicate]

I have a couple of scripts to work around Gnome Shell's inability to work well automatically when swapping between FHD (1080p) and UHD (4k) screens. I set various things with gsettings, restart nemo, ...
0
votes
1answer
28 views

SSH fails in Crontab after reboot

I am regularly running a shell script through Crontab that uses SSH to connect to a server. If I run that script manually it runs through successfully. Within the same session Crontab will ...
1
vote
0answers
22 views

notify-send not showing popup message

I have a script which executes on certain conditions, whenever I manually execute the script, the popup appears, however if i try to aumotate the script(i.e. run the script right after system is ...
0
votes
3answers
24 views

How to run a Python script not as '~$ python myscript.py' but as a single command '~$ myscript'? [duplicate]

I have a Python script which takes command line arguments. When I want to run the script I have to navigate to its directory and run: python myscript.py [arguments] How can I run it like: ...
0
votes
0answers
18 views

start script after resume as logged in user (not root)

I'm running owncloud client in Ubuntu and after a suspend/resume there's a bug in owncloud which makes it not be able to connect to the server. I wrote a little script which should restart owncloud, ...
0
votes
1answer
24 views

Script not running on resume/wakeup in Ubuntu

I have a script named 999_thaw_flash.sh in my /etc/pm/sleep.d The script follows like this :- export DISPLAY=:0 #!/bin/bash case "{$1}" in resume|thaw) lynx --dump link1 >> file1 lynx ...
8
votes
9answers
35k views

Filenames with spaces breaking for loop, find command

I have a script which searches all files in multiple subfolders and archives to tar. My script is for FILE in `find . -type f -name '*.*'` do if [[ ! -f archive.tar ]]; then tar -cpf ...
0
votes
2answers
4k views

Ubuntu FTP script to take backup and upload in my FTP server

Hie all I am trying to backup of my application directory, database backup and then sending it to my ftp server at hetzner by using the following script and i get few errors my server details: ...
3
votes
2answers
5k views

Add seconds to a given date in bash

I have a complete date plus hours and minutes. I would like to add a number of seconds and display the result as a date "day.month.year hour:minute". "date" doesn't seem to be able to add seconds to ...
1
vote
2answers
17 views

How should I set enviroment variables at GNOME login - not shell?

Ubuntu 12.04, GNOME Classic I have a script that I execute from /etc/bash.bashrc. Whenever I open a terminal, it sets some environment variables needed for my applications to run. I execute them from ...
0
votes
0answers
14 views

reboot bash script for Beaglebone stops without finishing

For the longest time I used the following script: #!/bin/bash echo 'start' && ssh -o 'StrictHostKeyChecking no' root@192.168.7.2 'reboot'&& echo 'end' which echos "start" and also ...
2
votes
4answers
10k views

When trying to run Android Studio sh file, chmod +x and checkbox just instantly fails (as root too)

I want to run the new Android Studio IDE just released at Google I/O 2013, and when I try to execute studio.sh, it opens it in a text editor. If I enable running as application in properties, it ...
0
votes
0answers
11 views

Scripts for disabling and enabling proxys are not working [duplicate]

I have following scripts for enabling and disabling proxys, but looks like they are not working. Do you guys know what might the problem be? enableProxy.sh #!/bin/bash export ...
28
votes
5answers
78k views

How to run a script during boot as root

I had a script that automatically enables my wifi without using networkmanager, but I don't know how to run the script as root while the system is booting. How do I make the script run automatically ...
0
votes
2answers
39 views

Bash scripting problem on echo -ing the current working directory

I have this code: #!/bin/bash #clear screen clear # Ask for name of directory to create echo "Please enter a directory name" echo "that you wish to create" read dir1 # create directory mkdir ...
3
votes
2answers
44 views

How to write a script to toggle unitytweaktool setting (hotcorners)

Specifically, I want to toggle hotcorners on/off every time I start a steam game. But I have no knowledge of scripts of any kind. Any resources to learn this kind of stuff would be great. Please ...