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
vote
1answer
322 views

Ubuntu start Node.js server and open Chrome in kiosk mode

I'd like for a computer to immediately start a Node.js application on boot. I'd then like Chrome to open in Kiosk mode, but only after the server has been started. Looking on the Ubuntu Stack ...
0
votes
1answer
231 views

What can I do about “cannot execute binary file”

I have a little shell script that simply starts up a Java program. It is installed somewhere deep in the hierarchy, so I don't want to add its containing folder too my path. So I put a symbolic link ...
2
votes
4answers
219 views

Add a display to let user wait in bash

I am looking for a pretty stupid piece of code for bash that will show a kind of "please wait" rolling display, with the characters : - \ | / The first problem is that I don't know the name of this ...
1
vote
0answers
38 views

Is there any way to see make file with all variables substituted

I have huge long makefile written by some other guy, where all coomands contain variables. In order to decode what this command is doing i have look around what that variable is and its taking too ...
0
votes
1answer
211 views

Eject all disks and dmg's with Automator script in Mac OS X

I have created an Automator Service to eject all disks in Mac OS X. find /dev -name "disk[1-9]" -exec diskutil eject {} \; This works, but I still receive an error message afterwords: "The action ...
1
vote
3answers
62 views

changing order of files

I have a series of files named in alphabetical order (xaa.tif to xdg.tif). I need to reverse the order of the filenames so that the last file is processed first in a script. I would like to rename ...
1
vote
1answer
233 views

How to rename a movie file and also files ins subdirectories (e.g. subtitles) beginning with same prefix

I've several directories with movie files , and also subdirectories with subtitles files with same prefix or starting with same prefix. I want to rename subtitles files with the Directory name it is ...
0
votes
5answers
3k views

How to test if a variable is equal to a number in shell

I have this shell script that isn't working. Input: Server_Name=1 if [ $Server_Name=1 ]; then echo Server Name is 1 else echo Server Name is not 1 fi Output: Server Name is 1 But, if i ...
1
vote
1answer
88 views

How do I write a conditional assignment in a Linux script?

I need to create a formula in a Linux shell script. If this was DOS, I'd (probably) be fine, but I've made the change and need to learn....! D1 = a 5-digit number between 40500 and 49500 (this is ...
1
vote
2answers
400 views

Filling up the hard drive until certain amount of space is left?

I'm doing some testing of a product on Apple and Android devices. I'd like a script that will fill up the devices hard drive until 100KB space is left on the drive it's runs against to. Also in linux ...
1
vote
0answers
121 views

Chrome OS sudo startunity app

I am running crouton unity on a Samsung chrome-book. How do i automate a shell script to start unity into a chrome OS app that I can place on the chrome shelf next to the other chrome apps? i want ...
0
votes
1answer
65 views

Is it possible to automatize a shared host setup using bash shell script?

Preamble: Never created a shell bash script before. So, and first of all, I'm not even sure if this IS the right tool for the job. If it isn't, please, and before all, let me know what, in your ...
0
votes
2answers
278 views

Batch file rename script swapping substrings in filename?

I have a group of files named like title_december_word1_word2.png and want to iterate through the directory and swap word1 and word2 within each file. i.e. go from button_december_state_pressed.png ...
-3
votes
1answer
2k views

batch move/cut folders and its content to another folder

I have this batch script that allows me to copy folders and its content from a text file, could someone help me adjust it so it move/cut the folders+content and not just copy? set ...
0
votes
1answer
49 views

Linux flow control exit to terminal on failure

I have a query with flow control. I want to exit the script to terminal when the message is: HOSTNAME NOT ADDED IN /tmp/hosts EXITING, which is a failure message. if grep -o 'abcdefgh01.was.db.dcbc' ...
1
vote
1answer
567 views

Use “>>” Redirection Operator for Non-Existent File In tcsh/csh

I'm writing tcsh scripts and I would like to append to a log file, but if the log file doesn't exist before appending to it, I get an error (reproduced below). In bash the file gets created if it ...
1
vote
1answer
182 views

How do I use shellscripts for rails with 'screen'?

I've recently started Ruby on Rails development, and I'm using Vagrant as a VM to contain my Rails project, because Windows is a terrible OS to use for any sort of Ruby development, due to the ...
1
vote
1answer
266 views

error when using while loop in bash script

I am getting an error 2: [: missing ] when using the following while loop: #!/bin/sh while ["$INPUT_STRING" != "bye"] do echo "please type something (bye quits) " read INPUT_STRING echo "you ...
1
vote
2answers
370 views

Convert Month Number to Month Name

Is there a way to convert month number to name with a script? example: 2013-10-22 will become Oct 22 Thanks. BTW, I don't have the GNU date and my OS is AIX.
1
vote
1answer
393 views

Bash Script for Rar command

I need a script to rar my files usage will be like this r1 archivename fileordirtocompress with following attributes rar a -m0 -v1024000 -r How whould this bash script look like? #!/bin/bash ...
1
vote
1answer
810 views

How can I save some terminal commands as a file and run them?

I am using OpenSuSe 12.3 I want to create a link on my desktop for some specific terminal commands. The background is that I do some backup via rsync and don't want to type the commands every time. ...
1
vote
1answer
387 views

In a Shell scripts, check version of installed package, make a decision based on output

Looking to write a cross distro / cross version shell script that makes sure a forced version of PHP is installed Example: Ubuntu 12.04 has 5.3, Ubuntu 13.10 has 5.5, Debian 7 has 5.4 I need this ...
0
votes
1answer
132 views

Automated git push attempt does not work - authentication issue

I'm trying to automate a very periodic git add/commit/push cycle using a shell script and cron under OS X 10.8.5. The script is as basic as one would expect it to be: cd /my/directory git add . git ...
1
vote
3answers
329 views

How to identify the local network you are connected to

I need a script to be able to identify if the computer is connected to my home network, to my work network, o to a different network, either by wifi or by cable. My question is if there some network ...
0
votes
4answers
2k views

Listing all words in a text file and finding the most frequent word

I have a file which contains lines. How do I write a script that will find and print out every word in the file, one word per line. Then find and print out the most occurring word (case sensitive) ...
0
votes
2answers
131 views

How can I auto-connect to a WPA2 Enterprise network?

I would like my computer to automatically connect to a WPA2-Enterprise network as soon as it boots whenever the network is available, without any action needed by me. The computer already offers to ...
0
votes
2answers
101 views

Rearrange content of a file

I'd like to rearrange the content of a file on a per line basis (see below), ideally without using Perl or Python (I'm not allowed to... Don't ask.) The input file contains unordered header lines and ...
0
votes
1answer
2k views

Move all files from multiple level sub folders to 2nd level subfolder

I'm looking for windows command or batch script to help me, i Spent 3h reading/ trying to find a solution i know its out there but my lack of scripting/programming isn't helping, hoping some can help ...
0
votes
2answers
39 views

Where to place an executable Perl script?

I'm now planning a solution that has to call a script that's running on a Linux \UNIX host. I'd prefer to place that script in a folder that exists in all kinds of Linux and UNIX. This helps me to ...
0
votes
1answer
58 views

How can I batch insert a certain .txt file into every subfolder?

I'm trying to figure out how to insert a licence.txt file into every subfolder, any ideas how to do this in windows command line?
1
vote
1answer
49 views

Filtering out incomplete log entries

I'm trying to get some garbage collection logs into Splunk. However, when java starts garbage collection, it starts the log entry, then when it's done it puts in the end of the entry. Splunk treats ...
1
vote
1answer
639 views

For Windows systems, will “.bat” or “.cmd” extension make any difference for my script?

Assuming that my shell script is entirely based on DOS commands(dir, cd, etc and not VBS or PowerShell commands), using .cmd or .bat extension for it's name will change something? I mean, it will be ...
1
vote
1answer
478 views

Can't get computer to reboot via script

I need to reboot an embedded system via a local network webpage (a CGI script). I have the page built, and it calls a script on the station (which is the (apache) host of the webpage). This script is ...
0
votes
0answers
58 views

Energy volume calculation script

Hi I want to write a shell script for energy and volume calculations for different lattice constants. For convergence of energy,using siesta. can anyone help I tried this work manually but now want to ...
0
votes
1answer
111 views

New process being created while checking with 'if' in bash

ps -ef | while read line; do for i in $line; do if [ $i = 'bash' ]; then echo $line; fi; done; done; unset i; The command runs properly displaying the Bash ...
0
votes
2answers
105 views

Instructions embedded in Bash script?

Is there a way to make a bash script require a set of parameters when it's loaded, and if not, it will automatically spit out an echo to the screen giving instructions? Looking at this example of a ...
0
votes
0answers
235 views

Crontab command set not working

I'm trying to set up crontab to run a shell script, but for some reason, the script doesn't get executed. I'm on system with OS X 10.8.5. crontab file 0 12 * * 1 /absolute/path/to/myscript.sh 0 15 * ...
3
votes
2answers
338 views

Xterm control sequence to get RGB value for ANSI color

The meat In (some) terminals you can use a sequence like this; printf "\e]4;3;rgb:cc/78/33\e\\" to set the third color in the ANSI color palette to the RGB values represented by #CC7833. Can you ...
1
vote
1answer
501 views

Entering into multiple directories in Unix and deleting a particular file

I have a list of directories that I want to go into and delete particular files. For example, the directory names I have are as below: 091513 090213 082612 071611 020908 011009 ... 062308 Each of ...
1
vote
2answers
115 views

Verifying which SMTP server software is used by remote server

I am trying to catalog which smtp servers are used in an heterogenous pool of servers, and so far I was doing : echo "HELO localhost" | telnet localhost 25 2>/dev/null | grep 220 #process the ...
1
vote
1answer
639 views

How do I create a one time use startup script on Linux - Centos 6.x

I want to set a script that will only run one time on a Centos 6.x box and then never run again, since it's going to set some system options based on hardware and then it's all set.
1
vote
3answers
393 views

Avoid launching explorer to UAC-elevate a program from shell

I'm a member of administrators group on Windows 7. I need to run foo.exe from a Cmd or Powershell. The exe file requires elevation to work but the elevation is not specified in its manifest. Usually ...
2
votes
2answers
56 views

How to use $date in Unix script

I'm using $date command in a Unix script and it is giving as "Tue Aug 27 05:53:37 EDT 2013". This is coming as an automatic mail. The timestamp value is long and it wraps to new line. How can I ...
0
votes
1answer
907 views

Execute a jar with double click in linux

What I'm trying to achieve is to run a java program on any Linux system (Ubuntu, Fedora, etc... covering as much as possible) by simply double clicking a file-like I would on Windows. I have created a ...
2
votes
1answer
401 views

Running commands and shell scripts in Ubuntu

I'm trying to run a shell script in Ubuntu to flash my Firefox OS phone. I've downloaded and unzipped the new version. I've launched the shell and navigated to the directory where the .sh file is. ...
2
votes
3answers
219 views

Utility to non-destructively fold or re-indent HTML

I have a script that takes input from wget or similar and searches through it for key words using grep. (I promise i am not trying to parse HTML with regular expressions, it is just a convenient way ...
0
votes
2answers
66 views

How to Sum Date (in minutes) Shell

I need some help here, I'm not a expert with shell scripting but I am trying to do a script where I need to take the Epoch number followed by the date, but for with the all hours of the day with a ...
7
votes
1answer
2k views

Shell script to find all types of files in a directory with their count

I want to write a shell script or alias to find the number of different types of files in a directory. For example, sample output of script should be: *.h 20 *.c 40 *.cpp 10 Makefile 3
2
votes
2answers
120 views

How can I get the shell-script-mode in Emacs to intepret #PBS -S /bin/bash to be a bash shell code?

I am using Emacs on a LINUX system that uses Portable Batch System (PBS) for controlling the use of resources. The PBS scripts require "#PBS -S /bin/..." as the first line in the script to declare the ...
1
vote
1answer
450 views

Grab single image from website on a regular schedule

I want to grab the same image (from a website) every x minutes to eventually make a timelapse video. My issues are: setting up the schedule to grab the image and saving the image with the ...