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)

0
votes
2answers
40 views

create scatter plot

file (1. arg) will create (scatter plot) for n. column (x-axis, 2. arg) and m. column (y-axis, 3. arg) function is called myfun sourcefile 1 3 for scatter plot of 1. and 3. column from file ...
0
votes
2answers
20 views

appends n-th line from the file x at the end of the file y

I have been asked to write a command that appends the n-th line (MYN) from a file (x)to another file (y). Here's what I've done so far: MYN=4 hey=$(awk 'NR==$MYN' x) echo "$hey" >> y But why ...
-1
votes
1answer
31 views

print characters behind the digits many times as value of digit [duplicate]

function/script, that for argument in format (alphas and digits) afa5hgt3tt, errerew9ax66w, prints characters behind the digits many times as value of digit, e.g. hgthgthgthgthgttttttt ...
0
votes
2answers
69 views

How do I write a Bash script for this scenario?

I have these files in the directory home/acs. TBBN027162G_38d8-2f08-0c40 TBBN027605G_38d8-2f08-1518 TBBN027941G_38d8-2f08-0d1c TBBN027923G_38d8-2f08-35e4 I want to read TBBN027162G as service_id ...
0
votes
1answer
25 views

Try to execute a script (adduser.sh) in root /$

I'm a new user to Linux and been practicing using creating/using scripts in bash. I found a script to add new users automatically but when I try to run the script in root, I keep getting the same ...
1
vote
2answers
29 views

Make echo ignore spaces?

I have a file called temp1 sCellEventTrap-03-27 TRAP-TYPE -- CAC Code: 01 ENTERPRISE compaq VARIABLES { scellNameDateTime, scellSWComponent, ...
0
votes
0answers
12 views

OpenVPN --up called scrip does not work properly

I use such command to run my OpenVPN connection (part of script): gw=`netstat -rn|grep UG|awk '{print $2}'` openvpn --config ./openvpn.ovpn --up "./up $gw" >/dev/null 2>/dev/null& So I ...
0
votes
1answer
20 views

Ubuntu terminal runs script files as packages?

Hi Ubuntu newbie here. Previously I tried installing something which would allow me to open packages through the terminal. However, when I go to run script files through the terminal, instead it ...
3
votes
2answers
47 views

How to execute a custom script when Internet reconnects?

My Internet gets disconnected every now and then. I'd like to run a Bash script every time the Internet reconnects. The script is quite simple: #!/bin/bash mplayer /home/user/sound.mp3 It's placed ...
6
votes
1answer
71 views

How can I send commands to specific terminal windows?

I'd like to write a script for opening multiple programs (servers) simultanously in separate terminals - doesn't matter which one - and assign different commands to different terminals with commands ...
0
votes
1answer
37 views

Run Python script with root privileges (not from terminal)

How can I run a Python script which, upon execution, brings up a dialog prompting the user for his root password - so that the script is run as root, being able to make changes to files within the ...
0
votes
2answers
39 views

Ubuntu can't find my bash-script at /usr/bin/

On my first Xubuntu I successfully copied my script trans.sh to /usr/bin, made executable and after that I can run it in any position of terminal, but my second Xubuntu can't find my script in ...
0
votes
1answer
12 views

running command on remote host by ssh fails when running inside script

The Situation: My Computer runs on Kubuntu 14.04. I am Admin of a Students House with some Netgear-APs. The idea is to have a script rebooting them all by one script. (ssh-key isn't posible) The ...
1
vote
0answers
17 views

Problem running backup script at shutdown Ubuntu 14.04.2

I want to run a script at shutdown, and a far as I can tell I've followed the proper procedures. The script (close) is supposed to launch another script (gdrive) in a terminal which prompts me to sync ...
2
votes
2answers
21 views

Executing wmctrl from bash

After playing a little from the terminal with wmctrl, now comes the next step. Execute wmctrl from a bash script. I do achieve to execute wmctrl in a bash when it is completely alone. Example: ...
2
votes
1answer
24 views

Flush Terminal Buffer?

I have a (proprietary) program which I start with ./program -a asdf in the Terminal. When I do that, I can see all the output at the right time. However, when I want to use the programs' output in a ...
0
votes
1answer
15 views

Help creating crontab to help with Disk Space Management IE: Delete files over 1 week old [duplicate]

I need a script I can call in crontab that equates out to --- find all files < 1 week old | rm files. I use macrium reflect free edition to back up my windows machines to a samba share ...
-1
votes
2answers
46 views

using a sudo command without a password for a certain app

I'm using a python script to run docker, but docker requires sudo commands to run and it's bad practice to store the sudo password in the file or give the whole python script sudo rights, I've seen a ...
3
votes
2answers
303 views

Tee doesn't get whole output from the pipe

I have a script executing commands like: export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH;./some_app -i $INDEX | tee $LOG echo "Number of errors: $(grep "ERROR" $LOG | wc -l)" The problem is probably in ...
0
votes
0answers
8 views

Read windows registry remotely via WMI or simular

Does anyone know if it is possible to read windows registry information from within Ubuntu, I realise this is possible using the Offline registry editor, but I want to read the data from a remote ...
2
votes
1answer
29 views

Is it possible to cancel or clear a notification created by a bash script using notify-send?

So I wrote a little script that makes sure a certain user plugs in a laptop when he logs on (it disables if he doesn't). The script uses notify-send to tell him to plug it in. If he plugs it in, the ...
0
votes
2answers
14 views

cron job wont execute the script

I have the below script #!/bin/sh tail -fn1 /app/agile/agile931/agileDomain/servers/01mustgagl01.natusmed.natus.com-AgileServer/logs/agileDomain.log| \ while read line ; do echo "$line" | ...
0
votes
0answers
10 views

Psycopg2 can't commit to a local database [on hold]

I've got a postgresql database on my local machine. I'm trying to write a python script, for use on many machines, that will query system information and then store it to a database, called ...
-1
votes
2answers
63 views

Help with script

#!/bin/bash a=`netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n | grep -v '1 ' | grep -v '2 ' | grep -v '3 ' | grep -v '1.1.1.1' | grep -v '1.2.2.2' | grep -v '127.0.0.1' | ...
1
vote
2answers
44 views

How to disown a chromium or chrome app on double click

I wrote a bash script to open an app (by double click) in my chromium. The code works but after opening the app when i close terminal the app also closes. I have searched through web and found out ...
0
votes
0answers
13 views

Where do I put Ubuntu server post install script files

Using the kickstart app, I can create a (I presume) bash script to run after the install finished in a chroot environment. If I have pre-writtren scripts and config files to copy over, can I include ...
0
votes
0answers
14 views

Install script as service running under speciffied user

I would like to install services into init.d folder in most standard way. Suppose I have script which should be run under specific user and starts the service (tomcat8 good example) ...
0
votes
0answers
12 views

How to run a script between login(entering password) and being logged on(showing desktop)?

Is there a way to execute a script when a specific user logs in; after they enter their password but before they are actually presented with the desktop? The script in question may lock the computer ...
0
votes
2answers
40 views

apt-get exits bash script after installing packages

I have read the answers in this post but it doesn't seem to work for my problem. I am executing a bash script via stdin from wget: wget -O - http://serverip/subfolder/script | sudo bash I've tried ...
0
votes
1answer
25 views

Using wget with Streamcloud and pages where you have to wait

I'm new to bash scripting and as I heard of "wget" I decided to write a script to download just the .mp4 file from a streamcloud (or whatever) link. I use it normally like: wget -q -O - ...
2
votes
1answer
31 views

How can I force a command to execute before an application starts running

I want to perform certain actions via a bash script before opening any application eg. firefox/ deluge/ VLC via GUI or CLI. The script should be executed only for certain applications and not for all. ...
0
votes
0answers
45 views

How to change MAC address “permanently”?

I am using Kubuntu 15.04. I was using macchanger eth0 -rto change my mac address. But there were two problems: Every time I disconnect and again connect to the network, the mac changes to the ...
0
votes
3answers
58 views

logout current user from script

I would like to create a script that: run some commands execute sudo su - [some other username] after I exit from [some other username] -> logout Example: test.sh echo "test script" sudo su ...
0
votes
1answer
24 views

How to pass a command with variables to at?

So, I'm making a bash script that's supposed to accept times and an extension from the user (through zenity) and schedule a call with sipcmd at the given time: extension=$(zenity --entry ...
3
votes
3answers
52 views

bash: populating array with elements containing spaces and special characters

I want to be able to populate elements of an an array with arbitrary strings, i.e. strings that may contain \ and spaces for instance. I wrote this : #!/bin/bash function populate_array () { if ...
0
votes
1answer
25 views

Run the script with screen

I write a script to run p2pool. I can not understand how to add a run through the "screen -dmS"? #! /bin/sh ### BEGIN INIT INFO # Provides: p2pool start # Required-Start: ...
0
votes
1answer
17 views

set -n not working in shell script when executing with source

this is the shell script.. #!/bin/bash set -n <<COMMENT1 tHIS IS A MULTILINE COMMENT MAN COMMENT1 <<COMMENT1 THII COMMENT1 : echo "this is ashok" echo "${LOGNAME}" when executing ...
0
votes
0answers
19 views

Script in /etc/network/if-up.d not executing when eth1 is on

I have a script in /etc/network/if-up.d . My intention is that script will execute automatically whenever my eth1 interface is up. But it is not happening. The script also have 755 permission level. ...
0
votes
0answers
31 views

I want to run a script on boot system Ubuntu 14.04 Server

I've done anything like this I made a symlink in /etc/init.d sudo ln -s /home/sts/erp-enterprise/bin/jleaf-apps /etc/init.d then I run the command $ sudo update-rc.d jleaf-apps enable then ...
-1
votes
1answer
33 views

I want to run a script to start the server automatically at system Ubuntu 14.04 Server

I've done anything like this I made a symlink in /etc/init.d: sudo ln -s /home/sts/erp-enterprise/bin/jleaf-apps /etc/init,d then I run the command: sudo update-rc.d jleaf-apps enable then appears: ...
2
votes
3answers
36 views

How to make a bash script execute when the battery on my laptop begins charging/discharging?

I have a conky setup that displays my battery level. The problem is, whenever I plug/unplug my laptop from the charger I need to run the conky-startup script to get it to display properly. I find this ...
0
votes
0answers
15 views

Xchat and cronjob?

I've submitted a thread in Ubuntu forums. Where I talked about if there's a way to automatically send a message after a certain amount of time. One guy replied and said to me that he has wrote an ...
1
vote
3answers
69 views

Bash: What to do when control-c won't kill a process, is there a better solution to the on/off button?

The full title of this question is: Bash: What to do when control-c won't kill a process, due to the fact that the bash script contains a loop which calls another process: Is there a better solution ...
0
votes
0answers
24 views

Shell script to retrieve MTR data

I made a script, to retrieve the data of a mtr to a specific IP, and log into graphite the average time response (ms) and the packet loss: But sometimes, the script fails, mtr report come like this: ...
1
vote
0answers
21 views

Perl Manipulation [closed]

So, I'm trying to analyze some data. I have a file that looks like this : SCF DONE 1.000000000000000 30.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 ...
1
vote
1answer
38 views

passing file from bash script to gnuplot script

I am new to gnuplot and I am troubled in passing my argument alot, now I have this simple bash script and a gnuplot script. in the bash script plot.sh I should modify my file then send it to the ...
4
votes
5answers
244 views

Count the sum of each column in a file

In a file with different number of columns delimited by space ' ', How to count the sum of the columns. An example would show the need: File A: 1 2 2 3 4 5 6 1 1 1 5 Then the output would be: ...
-1
votes
2answers
33 views

How to copy an executing script from current folder to another by double click

How should we copy an executing script from one folder to the another? The script content is: #!/bin/sh zenity --forms --title="Add Friend" \ --text="Enter information about your friend." \ ...
-1
votes
0answers
18 views

Ubuntu 14.04 has started running scripts on start up

I have run Ubuntu 14.04 ever since its release with no problems.On hp laptop. I have removed some old boot up files using synaptic package manager so i can install updates but recently when booting it ...
0
votes
1answer
21 views

Help Creating Rsync/Crontab script that checks if ExtHD is mounted before running

I have a toshiba 3tb ExtHD and it consistently gets unmounted if I say shutdown computer then turn it on to a live cd then reboot back into OS. Its a simple fix, all I do is unplug and re-plug the USB ...