A shell script is a script written for the shell, or command line interpreter, of an operating system.

learn more… | top users | synonyms (1)

3
votes
3answers
272 views

Rename files incrementally in a specific directory?

I have a directory containing bunch of .txt files , I need a command to rename these files by one command , so their name will be : file1.txt , file2.txt, file3.txt , etc . Any Help ?
8
votes
2answers
175 views

Get the total listening time from the CLI with banshee

Is there a way I can get total listening time from command line? I want to write a script to keep track of how much time I spend listening to music on a daily basis.
2
votes
1answer
60 views

Is it ok to just add a script to rc6.d?

I just made a script to backup my files at shutdown and added it to init.d then linked it to rc6.d and I gave it the prefix or runlevel of "K01myscript". The question is, will it cause any problem ...
3
votes
2answers
152 views

How to make sed works with break lines from file?

I'm adapting this script to insert file's content into another file. This is what I have now: #!/bin/sh # Check if first and second parameters exist if [ ! -z "$2" ]; then STRING=$(cat $1) # ...
0
votes
1answer
952 views

Cannot run cron job for a php script

I want to run a php script using cron job on localhost my script is situated at - /opt/lampp/htdocs/rrugd/myscript.php now as opt is under root, i tried adding the cron job for root as well as ...
25
votes
6answers
3k views

Repeat a command every x interval of time in terminal?

How can I repeat a command every interval of time , so that it will allow me to run commands for checking or monitoring directories ? There is no need for a script, i need just a simple command ...
0
votes
4answers
69 views

Basic bash printing question

I know this question is basic knowing how to write script, but I didn't learn that yet: I have a program that takes, as an input, a list like: str_1,str_2, etc. The string is always the same, but the ...
1
vote
1answer
102 views

How can run a gsettings command inside a postinst script from a custom .deb package?

I want to change the wallpaper when a custom .deb package is installed. In the postinst script I've written this: PID=$(pgrep gnome-session) export DBUS_SESSION_BUS_ADDRESS=$(grep -z ...
4
votes
2answers
237 views

How do I iterate the arguments in a bash script?

Is there any method to iterate the passed arguments in a bash script? This answer from my question shows me how to use each argument, but I want to iterate them because the number of arguments is ...
3
votes
1answer
402 views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
0
votes
2answers
29 views

How can I change this script in order to delete directories as well?

find /folder/*.* -mtime +14 -exec rm {} \; I tried rm -r and with -R argument, but without any result.
1
vote
1answer
54 views

How can I get a file's UbuntuOne URL from the terminal?

How can I get the UbuntuOne URL from a file in a bash script? Here's what my script does so far: I run the script via Nautilus Actions, and it requires one parameter and an URL in the clipboard. The ...
1
vote
1answer
75 views

How to see if there are any qbittorent torrents from shell script?

I run a script on startup that opens a browser, irc, and qbittorrent. It looks similar to this: chromium-browser & qbittorrent & xchat & guake & Is there any way I can detect if ...
1
vote
2answers
195 views

how to write a script that will execute xampp start and stop

I am trying to write a script that will enable xampp start and xampp stop with the same script without having to write in the terminal everytime. To start xampp, I write in console : sudo ...
0
votes
3answers
859 views

Autocomplete terminal commands [duplicate]

I had done this previously but now I don't remember the trick, Something like when you type in command in terminal it should auto complete it by matching it with the similar commands given in History, ...
1
vote
2answers
679 views

Create a Screen session with a bash script using contab

I want a .jar file to run every time the server boots up (we're using a VPS), and so I've edited crontab using crontab -e and then adding @reboot bash /home/bash/startserver.sh. But I haven't even ...
4
votes
4answers
260 views

How do I extract the version number portion from the version string?

How do I extract the version number from string=customer-asset-tag-1.0.2.9? Desired result: Component= customer-asset-tag version number=1.0.2.9
0
votes
1answer
37 views

script to backup file deleting file

Working on a bash script to take backup of a file, but the problem i get is that mv delete the file or rename it and create a file with the backupname. Script: test="/home/sysadmin/test/hei2.back" ...
1
vote
1answer
65 views

How to check if a restart of open-iscsi was ok

I am working on a bash script to connect a iscsi initiator to a target. After I have edited the iscsid.conf in the initiator I have to restart the open-iscsi with the command: service open-iscsi ...
2
votes
1answer
73 views

Can I open a new terminal with a new binary executing in it?

I tried to write a script that opens a new xterminal with some binary file(not command) running in it.The whole script looks like this: #!/bin/bash XTERM="/usr/bin/xterm -bg WHITE -e ...
2
votes
3answers
936 views

How can I run this sh script without typing the full path?

I'm still very new to Ubuntu. I'm using 12.04, and I'd like to know if there is a way to run this program/shell script without typing: /opt/idea/bin/idea.sh It's kinda tedious and I'm quite lazy. ...
2
votes
1answer
42 views

How to deleting files depending on their usage?

How can I use a script in order to delete files according to how much I using them? There are a large amount of files under a directory. I would like to preserve such files which I use (open) very ...
0
votes
1answer
43 views

Crontab wont run a script

I've set a script to run every 10 minutes using cron, but it does not run. It works when I run it manually. bin path is /usr/bin/. The script contains: #!/bin/bash scrot 'screenshot.png' -e 'mv $f ...
0
votes
0answers
19 views

Startup script for pxeboot

I am working on pxeboot. Now i want to do startup script in pxeboot server and whenever client started the startup script will run on the client machine. How to do that. ?
1
vote
1answer
41 views

Check if connection worked if not return error

Working on a bash script to connect a iscsi client to a server. How do I put this command: iscsiadm -m discovery -t st -p 10.0.0.30 in a if to check if the connection was established, if not it ...
3
votes
1answer
102 views

Why doesn't the xbacklight command work in rc.local?

When I execute the command xbacklight -set 10 in my terminal the brightness is set to 0.1 as it should. But when I use this command in my rc.local-file, then it is not executed upon start -- because ...
0
votes
2answers
86 views

Start-up / Reboot scripts for different users

I'm still trying to learn a little more about bash scripting and start-up / reboot, I have read about crontab @reboot and also just looking at other options but I just wondered if someone could maybe ...
0
votes
1answer
122 views

.bachrc $PATH doesn't find my python scripts

I've tried adding a path to my .bashrc file as follows export PATH=/beda/users/home/user252083/bin:$PATH and yes, I can then run the binary "bader", which is in the bin folder from anywhere. I also ...
0
votes
0answers
60 views

Java -jar arguments being ignored

I'm using Ubuntu 13.10 and Oracle Java 1.6.0_45 (need the oracle version for some development work I'm doing). I can recreate this problem with nearly any jar file but the specific one is with a ...
3
votes
2answers
147 views

How to create a native application from a Shell Script?

I created a little application using Bash and Zenity that I wish to install on my system as a native application as well as a package that I can distribute. I have a .desktop file for my application, ...
1
vote
1answer
220 views

Script to rename files

I appreciate any help in advance. I have written a script to rename all .BMP files, and it seems to work, but I get the following error/message for each file: IM2019.BMP mv: cannot stat ...
5
votes
1answer
214 views

Oneliner command to use kill given tcp port number instead of PID?

I often do e.g. sudo netstat -lpn |grep :8088 view the output tcp6 0 0 :::8088 :::* LISTEN 11189/java and then sudo kill -kill 11189 I'd ...
0
votes
0answers
28 views

Hibernation fails, after trying to repair no-WLAN-problem

After noticing that my Ubuntu 13.04 had no WLAN function after resuming from hibernation, I tried the sudo restart network-manager as explained in this question: No wlan after standby . It brought ...
0
votes
0answers
815 views

Preseeding/Kickstart Ubuntu install

I am trying to achieve the following: I have created a kickstart script as adviced here: Automatic Installation - help.ubuntu.com and want to run it from the live session, without passing a boot ...
1
vote
1answer
449 views

How to run vbscript on ubuntu 12.0.4?

I ve just installed ubuntu 12.04.4 on my laptop. I want to use vbscript for cding on my website, because we have the vbscript for our study course [ class 11 multimedia cbse]. but I cannot find a ...
0
votes
0answers
44 views

A script which can be run from a flash drive and modify startup applications

So I have created a script I would like to run on computers at startup on the network I manage. Each is unique, so merging settings accross the network would be problematic. I could change each ...
3
votes
4answers
312 views

grab volume name of volumes over 85%

I want from the output below grab all the volume names that have a capacity over 85%. I know that there isn't one in ths example but lets pretend there is. :) Filesystem total ...
0
votes
2answers
1k views

Why script with /bin/bash is working, with /bin/sh not?

My friend asked me why this two simple script are not working in both shells: Test File "abc.txt": aaa 111 bbb 111 ccc 111 ddd Script #1 (a): #!/bin/sh while read -r line ; do echo ...
5
votes
1answer
166 views

How to set my Bluetooth python script on higher priority than Ubuntu's request?

I have got a Bluetooth Python Server Script on Ubuntu to connect with an incoming request from a Smartphone device. However Ubuntu's Bluetooth is getting the request before my script can react on it. ...
2
votes
1answer
75 views

Bash script to check if mdadm is installed if not install it

I am currently working on a bash script to create raid5 with 3 disks and one hotspare. I am confused of how to create a script which first check if mdadm exist, if not it will install it and name it ...
2
votes
2answers
241 views

Temperature & RAM monitoring script

I have the following script: while : do clear; echo "---------------------------RAM Load------------------------------$ free -mt >> memory.txt; free -mt; ...
-1
votes
2answers
120 views

Bash script download dynamic directories

How to download the most recent packages in deb files (all in a folder) for my platform (x86_64/i386) & distro with bash script? There is no PPA for this apps. So I'm interesting in ...
0
votes
1answer
66 views

System Monitor Script

I created a simple script written in bash to constantly monitor my system temp and RAM free. while : do clear; echo "---------------------------RAM ...
1
vote
0answers
30 views

Moving files to usb stick and virus scan

I have the task of moving a single file to 50+ usb sticks and then virus scan them with clam-AV. I have a 6 way usb hub that I can use to speed things up. I am after running a script that prompts for ...
0
votes
1answer
250 views

Network Manager dispatcher.d script error

I wrote a script in "/etc/NetworkManager/dispatcher.d" to open the Firefox preferences dialog whenever I connect to a particular network (college wifi), because I have to enable proxy. The script is ...
2
votes
3answers
343 views

Nemo Custom Action (.sh script) does not execute

I created a .sh script for simple OCR-ing of screenshots that I make with Shutter. The script looks like this (ocrFile.sh): #!/bin/bash convert $1 /tmp/output.pnm cat /tmp/output.pnm | pamstretch 4 ...
0
votes
0answers
60 views

Kubuntu: open application on specific monitor using bash script

I use two monitors and i want to write a bash script which opens applications on my second monitor (thunderbird for example). I use conky which is also on my second monitor. I want to define the size ...
1
vote
1answer
115 views

Open a terminal a run a program on it automatically when the session starts

I have a script to open a terminal and run a command on it: #!/bin/bash export DISPLAY=:0.0 /usr/bin/gnome-terminal -e '/home/me/bin/application --option a --option b --debug' However, the ...
0
votes
1answer
90 views

How to trigger a script when an external USB disk is mounted?

I need to automatically copy images off a camera when it is inserted into the USB port. I've written a script to do the copying, and I've found that, by creating a file ...
0
votes
0answers
31 views

Does anyone know how to connect to network Drives using scripts?

I've looked around, but I couldn’t find anything that worked. I'm trying to create a script that runs at startup which connects to my colleges network folder(smb://stuff/stuff). This script would ...