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

learn more… | top users | synonyms (1)

-1
votes
0answers
16 views

script not working properly in crontab

I am trying to run a backup script. #!/bin/bash year=`date +"%Y"` date=`date +"%d"` month=`date +"%b"` monthful=`date +"%B"` mn=`date +"%m"` date1=`date +%_-d` b=`date +%_-m` cd ...
2
votes
1answer
36 views

Find not removing files in folders through bash script

I'm very new in bash scripting and I'm really stuck on the find method from Ubuntu. I want to search in the folder /opt/ for all folders to see if they are older than a specific date. If they are ...
-1
votes
0answers
29 views

Cuttlefish #!/bin/bash not working 0.o

I was running Cuttlefish on Ubuntu 14.04 with 2 scripts to dim and un-dim my screen when AC power changes to battery and reversed. I reinstalled today and can't make the script dimming or un-dimming ...
41
votes
3answers
45k views

ssh: automatically accept keys

I've written this small utility script: for h in $SERVER_LIST; do ssh $h "uptime"; done When a new server is added to $SERVER_LIST, the script is stopped with: The authenticity of host ...
-2
votes
1answer
28 views

Is there a script that moves all files in the folder automatic [on hold]

Is there a script that moves all files that get into the folder get moved to another folder My gameserver put logs into a folder and i want them to go to the /var/www (online)
21
votes
5answers
49k views

How can I make a script that opens terminal windows and executes commands in them?

I have three scripts I need to run when I start up my Ubuntu machine, they start services I use in my development environment. To do that, I manually open three terminals and type in the commands. ...
0
votes
0answers
21 views

Bash question with system processes? Stopping and renicing “Java” processes

I play minecraft on linux, and I would like to make a Bash script that does two things. First, I would like it to close the minecraft launcher's process. Secondly, I would like it to renice the ...
5
votes
3answers
187 views

How to pass '*' wildcard to path parameter of find command via a variable in script?

I want to use find to find files in a set of folders restricted by wildcards, but where there are spaces in the path name. From the command line, this is easy. The following examples all work. find ...
0
votes
0answers
20 views

UMS.sh (run as service) on Ubuntu 14.04 won't read configuration file

I'm trying to get my ubuntu 14.04 to run universal media server so I can stream movies to my ps3 (lowest firmware 4.55 unfortunately - unjailbreakable). After much research on the net I was able to ...
3
votes
2answers
341 views

Script doesn't work when it is run using '#!/bin/sh'

I have a script that use shebang : #!/bin/sh, but when I run it in my Ubuntu 14.04 terminal, it doesn't work and it says that some lines has unexpected operator. My friend in another computer could ...
2
votes
1answer
46 views

Shell script to move all images excluding ones with size in name using find?

I have a server backup of a WordPress site that has about 1000 images in the uploads directory. When an image was uploaded through WordPress it would create multiple sizes of the image such as: ...
0
votes
0answers
16 views

Run cron job to execute a script when a particular file is updated

I would like to automate a process which requires running a script to generate some files. To do this I thought that adding a cron job to run this script would be great. But I want cron to run the ...
2
votes
1answer
47 views

Shell script for list of users by groups

I want to write a shell script that generates a list of users. for each user display the username and ID and all groups the user is a member of it means like GROUPS command but for all users and with ...
5
votes
4answers
8k views

Problem with Bash script: 'declare: not found'

I had a script which was running fine but when I ran it today, it says declare: not found. I am using bash shell and path at the starting of the script is correct. Two flagged lines in my script are ...
0
votes
1answer
12 views

Running script to repair bricked Android [duplicate]

I have unfortunately bricked my device, one of those issues that most if not all of us who like to root/ROM our devices have had to deal with. I need to run a script that will fix the issue to where ...
0
votes
2answers
33 views

Media Scanner Script

I am a beginner with Bash scripting. I have recently been working on a script to harden Ubuntu computers for a school project. Everything is going well, except that the students are not allowed to ...
27
votes
1answer
1k views

How can I make cowsay say something every time I close the terminal?

I want cowsay to print something like "have a nice day" when I close the terminal. I know I have to have some kind of script, but I'm not even sure how to write a script or how to use it once it's ...
2
votes
2answers
1k views

How to make svn look for if there is an update once a minute and if there is call some script?

I wonder if it is possible to create such .sh script that a normal user would be capable to start with something like nohup ./superScript.sh >& /dev/null & and which would once a minute ...
6
votes
8answers
45k views

How can I check Internet connectivity in a console?

Is there an easy way to check Internet connectivity from console? I am trying to play around in a shell script. One idea I seem is to wget --spider http://www.google.co.in/ and check the HTTP response ...
3
votes
3answers
2k views

Cannot use “./” to execute a shell script

Maybe someone here would be able to help me out. Have installed Ubuntu 12.04 LTS (kubuntu) on two machines. The .bashrc and .bash_profile files are identical as the file structures on each machine is ...
2
votes
2answers
214 views

Run a standard command in bash script

I am writing a bash script to automate several actions: #!/bin/bash echo "Hello, World" NAME="${1}" PATH="${2}" echo $NAME echo $PATH eval "ls" I am going to call ls, ffmpeg and a lot of ...
1
vote
2answers
6k views

Why can't I write to a file even after 777 permission? [closed]

On my ubuntu server I have Apache and PHP and all that nessory stuffs.. but when I run a php file <?php ...
3
votes
1answer
337 views

How do I delete all pop/rap music?

I have all the music stored in ~/Music and I want to delete all pop music (or it could be a different genre). I was thinking to look the song metadata to check and see if a song is pop, and then ...
0
votes
1answer
96 views

Add custom script to PATH

I know there are quite some answers about that, but still could not make my way around it. I read all this and tried to follow the example under System-wide environment variables (for my case of ...
1
vote
2answers
308 views

sed “Permission denied” and “No such file or directory” errors while building Clockwordmod

Whenever I execute the command build/tools/device/mkvendor.sh samsung_aegis2vzw /your/path/to/the/boot.img I get this as the output build/tools/device/mkvendor.sh: line 83: /sedcommand: ...
1
vote
0answers
32 views

how to encode a shell script so others can run it but they can not read it

I want to encode a script, so others can run that script to get relevant result but when they run command cat it should throw output in encoded format.
2
votes
1answer
58 views

Rename all files in subdirecories

I am having a problem writing a script for mass renaming of files in subdirectories. I have a folder with multiple subfolders, and those subfolders have multiple files that I need to rename. This is ...
1
vote
2answers
51 views

How to run a shell script with a file argument located in the same directory at the script? [duplicate]

I would like to run a command with an argument placed in the same directory as the shell script, from a shell script. example: my_installer.sh: #!/bin/sh sudo dpkg -i --someflags=abcd blah.deb ...
1
vote
2answers
128 views

How to enable tab autocomplete for scripts located in ~/bin?

If I put an executable in ~/bin I can just type the first few letters of the filename and then hit tab to let the shell finish the rest of the name. While this works with executable programs, it ...
0
votes
1answer
13 views

Smartctl script to write zeros

So i have an old hdd that was badsectors and i wrong the following script to write zeros in badsectors that smartctl finds. The question is will this help the read/write errors or it is futile? the ...
4
votes
2answers
18k views

Run a nohup command over SSH, then disconnect

I want to execute a script, start.sh on a remote server which runs this: nohup node server.js & Naively, I call SSH like this: ssh myserver <<EOF ./start.sh & EOF This starts the ...
0
votes
1answer
28 views

Sharing variables between shell scripts [duplicate]

I have a shell script (let's call it parent.sh) which calls another shell script (child.sh), passing it an argument. The child script does some work and sets a value in a variable called create_sql. ...
1
vote
2answers
48 views

How can I run a bash script without affecting the file system?

I am trying to create some soft of a sandbox for linux systems (ubuntu). My main goal is to find out which files are executed by a bash script of my choice, without actually letting it run them. I ...
2
votes
3answers
80 views

Find & Delete duplicated files on multiple harddisks at once

I have 4 hard disks and want to find out which files on this four harddisks (including sub directories) are duplicates. It should be checked not only within a harddisk but against all the others as ...
2
votes
1answer
7k views

Tomcat Installation startup.sh not working

So I've followed the list of steps on : https://www.digitalocean.com/community/articles/how-to-install-apache-tomcat-on-ubuntu-12-04. When I try to run the startup script, I get this message: ...
7
votes
6answers
20k 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 ...
1
vote
2answers
56 views

Shell script file (.sh) does not run, and throws an error

I am new to linux, and I have a shell script (.sh) file I on my Desktop that I want to run. These are the steps that I did: This is the content of the test.sh file on my Desktop: #!bin/bash ...
6
votes
2answers
400 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 ...
2
votes
1answer
104 views

Cant read variable from user input in bash

I try to run script of my friend and I get this error when try to input some variable: : bad variable nameead: reload : not foundsh: 10: bin/reload.sh: bin/reload.sh: 11: bin/reload.sh: Syntax ...
2
votes
1answer
78 views

Udev not running scripts

I'm trying to make udev disable/enable my touchpad when I connect/disconnect my external mouse. I don't know what is wrong. When I call udevadm --test it seems to be calling my script, but when I ...
0
votes
1answer
32 views

Need audio player for bash script

I'm working on a small audiovisual project, and I'm writing an auxiliary bash script to control some stuff. However, I need to play a generated audio file for a few seconds before stopping it, the ...
4
votes
2answers
2k views

How to shutdown Ubuntu after (2 hours) of idle?

Running: Xubuntu 14.04 32bit. I have read several outdated, not working, working different that I want answers here and elsewhere. I had a script that resulted in shutting my Laptop down at boot time ...
3
votes
1answer
29 views

Write a script to automate installing applications on freshly installed Ubuntu

Do not ask me why, but I often found myself installing a Linux distribution (e.g. Ubuntu) over and over again in a year time. For myself or others. I often found myself installing the same ...
0
votes
1answer
38 views

Make all new .sh file executable

One of my script is making new .sh files in /tmp/ folder how can I setup that all new files in /tmp/ folder will get chmod -x automaticaly because my script is failing when trying to run scripts in ...
4
votes
4answers
377 views

How do I make an entire directory executable?

I have an entire folder dedicated to python scripts. I'm tired of doing chmod on every new python script that I write. Is there a way to make every file inside my folder executable if it is a python ...
0
votes
1answer
24 views

Cannot run script at start-up because of dependecy

I want to make some scripts running at start-up, but one of them.. I read a lot of posts and tried lots of ways but still cannot make it. Let me explain what I want. I have a ubuntu 12.04. I need to ...
1
vote
2answers
106 views

run script after wake up

I have a Toshiba notebook(Toshiba c50d a-133) and problems after waking up. When I close the lid Ubuntu go to sleep mode. After opening, it wakeup, but sometimes mouse and keyboard show no Function. ...
1
vote
2answers
55 views

How to create a script that will connect to a specific network

Using the integrated Network Manager, I created a new VPN Connection, called 'My VPN'. When I click it, it connects - great. Now I need to automate it a bit. Is it possible to write a script which ...
0
votes
1answer
24 views

start: Unknown job: tester while using upstart feature of ubuntu [closed]

I have a jar file which I am running like this in my Ubuntu 10.10 and then it starts my exhibitor server in the background - nohup java -jar ...
0
votes
1answer
54 views

What am I doing wrong with the shell script? Noob [duplicate]

I created a new document, opened it with gedit and the script is very simple and it works in terminal, basically something like this: #!/bin/sh sudo blah blah blah But when I save it on the ...