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)

0
votes
1answer
45 views

Shell script does not run properly

I need help running a shell script. At my high school, I am competing in a cyber security competition, and we are given virtual machines of operating systems with security vulnerabilities that we must ...
0
votes
1answer
81 views

How to cut some text from several files, replace them with names and some more?

This may be a big favor as I want you to help me write a complete script, but I appreciate anyone helping me in it and assure you that your answers help science improve :) If you don't have the time, ...
0
votes
1answer
54 views

Script: Recursively convert wma files to MP3, then remove WMA files

I'm trying to fix a script that recursively searches a directory tree for WMA files - converting them to MP3 files, and then removing the WMA files, leaving the converted MP3 files in their place. ...
0
votes
0answers
10 views

run a script when a session starts [duplicate]

I'm using ubuntu 15.10(unity), I want some scripts running when a session starts. I tried the following methods: Put those scripts in the file ~/.xsession, but it didn't work (It worked when I ...
14
votes
2answers
759 views

How to make my system delete all the files in a certain directory older than a certain time while keeping the directory structure intact?

I have a directory on my machine, think of it as my own sort of tmp directory, but it's in my ~ directory. And I want to make it so that my system every 3 hours deletes all the files in (though ...
1
vote
1answer
23 views

matlab returns error

I am running matlab in linux. While running a script in matlab I get the following error. here RayMet_012007.ray_paths is the input located in a custom directory. /bin/bash: line 0: type: ...
1
vote
1answer
164 views

script never completes last line

I wrote this script to get some files off a webcam server. The files, are all downloaded, but when I was running the script, the last line never ends, even after the file was downloaded. So, I would ...
0
votes
2answers
34 views

CRON: Starting new cycle while the last one is still running?

Example, there is 1 .py script set with CRON to execute every 5 minutes. What if that script takes more than 5 mins to finish? Would that cause the problem? Would .py program broke? Is it possible to ...
0
votes
1answer
31 views

writing lines into text file with loop

echo -n "##### INPUTS? #######" read -a inputs assume user's input: polv brmu ankr I need to write below line into text file w.r.t. the user's input with loop; stab_site polv brmu ankr ...
1
vote
2answers
90 views

Ubuntu with Kodi — how do I suspend based on audio output?

Ok, I am running Ubuntu 15.04 with Kodi 15.2 as an HTPC. I have always had problems with suspend and hibernate due to the fact that it appears that the two systems' power management cause some ...
3
votes
1answer
53 views

Have bash script run against a live file - Is it possible?

I have a script I've written and (finally) have it working like I want it to, as long as I run it against a static file. Is there a way to tail a live file and have the script perform its actions ...
1
vote
1answer
67 views

How can I make shortcut keys move the mouse, as an alternative to the touchpad?

Due to large quantities of Chocolate Cake falling on my computer's touchpad it has become unresponsive at times (though the left- and right-click works fine) and I would like to make it so that when I ...
0
votes
2answers
48 views

how can I rewrite a bash script as a one liner?

I want to add a gesture command using compiz. There is command plugin in CCSM, it lets you assign one of the screen corners on mouse move to execute a command. I want to toggle onboard screen ...
0
votes
1answer
28 views

Lubuntu script to reverse order of a list state-capital capital-state

I am new to Linux and have a project due in an hour and I know I can use tac to reverse a list, but how do you reverse order like: Birmingham-Alabama Atlanta-Georgia Topeka-Kansas To this: ...
-2
votes
1answer
50 views

Can someone please help me adding a simple while loop. it's better if it's releated to the script

Here's my script tried adding one kept getting an error. All help is appreciated. #!/bin/sh #Name:gamer #Date Created: 12/6/2015 #last modified: 12/8/2015 #Desc/Purpose: Updating and installing apps. ...
3
votes
1answer
43 views

Bash script not working properly from crontab

I've some scripts that run perfect if you run them from a terminal, but once you add them to crontab it's like the bash doesn't execute properly and doesn't continue with the first IF statement and ...
0
votes
1answer
41 views

Array in shell script

I want to store the output of the diff command into an array and to find the length of the array using a Bash script. I tried this, but it didn't work: arr=( $(diff -w file1 file2 | grep '<' | awk ...
1
vote
0answers
92 views

fswatch | while read | xargs running command twice

Thanks in advance for any advice I'm working on an fswatch command to launch a script when files hit the Downloads folder. fswatch --event Created Downloads/ | (while read x; do echo $x | xargs -0 ...
3
votes
1answer
41 views

How to execute a command after a certain period of inactivity, triggered by keyboard & mouse activity and full screen window?

My machine suspends after 5 minutes of inactivity, however I want to execute a command as well after 4 minutes and 30 seconds of inactivity. Is there a way to run a command after 4 minutes and 30 ...
1
vote
1answer
87 views

Run Android Studio on reboot using shell script

I'd like to start Android Studio while my computer starting. I used crontab and @reboot parameter: crontab -e and scheduled this task @reboot /home/ziko/reboot_cron.sh # JOB_ID_1 SHELL=/bin/sh ...
1
vote
1answer
57 views

Troubles piping echo output to xargs script for mv command

and thank you in advance for any advice. I'm working on a script that will automatically sort my downloads. The script is very simple, and running it manually has the intended effect. The problem I'm ...
-2
votes
3answers
47 views

Can anyone tell me how can this be achieved? [closed]

Prompting a yes no interface to user so as to re-execute a block of code.lets assume that block of code is echo "Hello"
1
vote
1answer
27 views

Date and time of execution of a program

How can date and time of execution of a program be loaded at middle of a program. Every time I use exec date command it seems to ignore everything beneath it.
0
votes
2answers
25 views

How to make a multistep command ask for inputs?

Sorry for the confusing title but here's what I want to do. I run this command quite often: w3m -dump http://www.example.com/file-to-save-as-text/ > ~/Desktop/saved-file.txt Is it possible to ...
4
votes
1answer
220 views

Command to compare two strings

I need to compare two strings and ignoring the case of the contents. IF [ $first != $second ]. Anything I can add to this command so that the comparison ignores the case.
0
votes
1answer
28 views

Way to take multiple input from same line separated by a space

I need to store three names in three different variables but taking input from a single line separated by spaces between them. Is there any way to do that?
1
vote
4answers
36 views

IF inside UNTIL. Not working any suggestions! [closed]

selected=MU team=xyz until [ $selected = $team ] do echo "Guess the best team: Manchester United->MU Arsenal ->AR Chelsea ->CH" read team if [ $selected -ne ...
5
votes
3answers
308 views

Difference between script command and manually copying from terminal to external file?

I was just curious to know if there any difference in keeping the record of the terminal commands using script filename and manually copying it from terminal. Please tell me if there exists a bit of ...
4
votes
1answer
47 views

New to unix need help with script

I am working on a script but I keep getting this error Syntax error: ")" unexpected (expecting ";;") here's the script #!/bin/sh #Name:gamer #Date Created: 12/6/2015 #last modified: 12/8/2015 ...
0
votes
1answer
56 views

Issue starting a demon process at startup in Ubuntu

I tried Starting Deamon process. I am trying to run this command during startup to start DTN2 deamon using command dtnd -c DTN2/dtn/dtn.conf -o DTN2/dtn/log -d in ubuntu 14.04 I made this as a shell ...
2
votes
3answers
119 views

Desktop Launcher Execute Bash Script In Terminal from URL

My setup is I have a website (www.example.com) that I have uploaded bash scripts to www.example.com/location/of/bash/script.txt I now would like a Desktop Launcher (.desktop) file that I can use to ...
0
votes
1answer
32 views

Cron job shut down the system ignoring the specified time

I made a script that asks the user if he wants to shut down the computer in 10 minutes or wait another hour and I scheduled in cron to run each hour from 18h to 7 am. However it happened two problems: ...
0
votes
1answer
33 views

-s: command not found in ubuntu 15.10

I want to see if a file is empty or not, and I have seen that the command -s FILE. The problem is that when I try to use -s (both in the shell and in a script) I get an error saying: command not ...
2
votes
1answer
40 views

predefined input in a nohup shell script

I am trying to write a shell script that I can then nohup as it is supposed to run for hours. I am a shell novice so I'm struggling with this a lot. The script should first open some software (ACE ...
1
vote
0answers
51 views

How can simulate mouse clicks in a cron job on a headless machine?

I have a headless machine running Ubuntu 14.04 LTS. I'd like to set up a cron job to daily click some buttons on a web page. I often use X2Go, and I know I could manually open an X session and use ...
1
vote
1answer
36 views

how to fix filenames with dash or space

I created a bash file, but when I run it to those files (or folders) which they have "space" or "-", my command doesn’t work! how to fix this problem. #!/bin/bash dpi=$(zenity --entry --text ...
0
votes
0answers
32 views

How to script creation of a grub menu item that boots to windows manager?

I have a grub script , which will create a boot-to-command-line menu item for each kernel installed on my system. I would like to expand this script, so it creates both a boot-to-command-line and a ...
1
vote
1answer
69 views

Unsure how to use my script [duplicate]

for my first year CS I need to know Shell Scripting, but I'm really terrible at this. I wrote this script for example #!/bin/bash [ $(whoami) != "root" ] && echo "Run as superuser" ...
0
votes
1answer
47 views

Bash scripts and file conflicts

and thanks in advance for any advice. I'm having trouble finding an answer to my question elsewhere. I've been working on a script that will watch a directory, and then move files to various other ...
1
vote
4answers
333 views

How can I add integers in an array

I'm trying to add some number in an array. Example: array=( 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 ) I've done it this way but I want to use an array and then sum up the numbers in a shell script. ...
0
votes
1answer
112 views

Interactive shell script autostart on custom Xubuntu live CD/USB

I'm trying to make a live usb which runs an interactive shell script when booting. I'm using Ubuntu Customization Kit (uck), xubuntu-14.04.3-desktop-i386.iso and syslinux (in order uck can build final ...
2
votes
2answers
83 views

My mount script isn't working, why?

#!/bin/bash mount | grep 'sda[1-5]' if [ $? = 0 ] then echo -e "its already mounted ! type u to unmount :\c" read word if [ $word = "u" || $word = "U" ] then umount ...
-4
votes
1answer
82 views

Is this because of a new version of whois or should I try out matriz for ipv6 (is ipv4 too old?)

This is concerning an old script from 2013 which some Ubuntu-Forum Users and Users at askubuntu came up with, together with me. The script is: #!/bin/bash awk '{ for (i = 1; i <= NF; i++) ...
0
votes
0answers
24 views

Load script file at login screen (xserver/user)

My current solution I have two files. One of the files is run via ~/.xsessionrc, this is required as xserver needs to be started for xinput command to function. The second file needs to be run as ...
0
votes
0answers
47 views

Editing Gsettings from Cron via script doesn't work

So, I'm trying to change my theme from a light to a dark version in the evening, and vica versa in the morning. However, Gsettings doesn't work from Cron, and the solutions posted here and here don't ...
1
vote
2answers
95 views

Is there a way to specify a certain range of numbers using array in a script? [closed]

I'm trying to add the first 20 numbers I generated randomly with an array in my script. Is this possible? I used my previous script to generate 100 numbers and was hoping I could use it in this ...
1
vote
0answers
31 views

bash script: gnome-terminal does not parse arguments

Using 14.04. I read several posts here and changed the command; however gnome-terminal comes with an error: Failed to parse arguments: Cannot open display: I have a bash script in which several ...
0
votes
1answer
66 views

run script after xserver started

I have a script which I would love to run after xserver has started. This file is located at /home/karl/.scripts/startup/sensei-raw-startup.sh. How to I invoke this file after xserver has started?
0
votes
1answer
32 views

[Edited/include]man: bash. \e and bash shell “enter” token

This is kind of a 2 part question and you'll understand why when done reading. To start, I was trying to figure how to cause an "enter" action inputted into standard output so that the script can ...
0
votes
1answer
66 views

Upstart not running .sh script

The information on the web regarding upstart, init and .conf files is rubbish. A lot of different places show completely different ways of doing things. Anyways, I have a script file ...