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
683 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
418 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
955 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
416 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
230 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
67 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
124 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
485 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 ...
0
votes
1answer
309 views

How can I programmatically register a file with Redmine?

I'd like to add a file to a Redmine server without going through the graphical interface. I'm making the files available to the Redmine server by a separate svn checkout process, so I just need to be ...
1
vote
1answer
917 views

How can I check through command-line the computer form(Desktop, notebook or All-in-one)?

For a very specific reason I need to check the computer form factor(Desktop, Notebook or All-in-one) remotelly, using a command through the command-prompt, powershell or vbs(Windows 7/8 systems). ...
0
votes
1answer
632 views

How to create Bash script when user root logout sending email alert include history

I found the following command: history | tail -20 | mail -s "log `hostname` pada `date`" mailid[at]corporate.com I want to combine it with an automatic logout script: The system should send an ...
2
votes
1answer
1k views

Running powershell scripts by drag-n-drop file or folder on it

Is there any way of running a powershell script by drag-n-dropping a file on it (just like you would drag-n-drop a file on a .exe file)? It would be also nice to be able to do the same thing with ...
1
vote
1answer
210 views

xargs in shell script

I want to group jpeg images by odd number and even number. So I did like following: $ mkdir odd $ mkdir even $ find . -regextype posix-egrep -regex ".*[13579].jpg$" -print0 | xargs -i -0 mv {} odd/ $ ...
1
vote
3answers
55 views

Write a command to switch to specific directories

I have some directories that I have to go to a lot more often than others, like for music, work, programming, etc. So I want to have exclusive commands, say "gotomusic" or "gotodropbox" to go to these ...
2
votes
1answer
151 views

What this command :(){ :|: & };: does? [duplicate]

What does this shell command do in Linux :(){ :|: & };: How can it be used in Denial of Service attacks?
0
votes
2answers
2k views

Shell Script Error using Cygwin

I got this error after execute shell script as below. $ ./script_test.sh ./script_test.sh: line 3: syntax error near unexpected token `$'do\r'' '/script_test.sh: line 3: `for ((j=0; j<"$N"; j++)) ...
-5
votes
1answer
243 views

windows 7 batch file for swapping filenames randomly

I need to write a batch file that goes into a folder and randomly swaps (renames) all the filenames. This folder has about 1000 files. So it is acceptable if there are few misses.
0
votes
1answer
3k views

How to pad strings with spaces in a Unix shell script?

I have data that looks like this: 01234567 09876544 12345676 34576980 I need to pad this with 11 spaces i.e. my output should look like this: ' 01234567' ' 09876544' ' ...
0
votes
2answers
82 views

How do I parse metacharacters for function input in bash?

I wrote a function in bash which gets * as input and therefore sould list all files in that particualar dircectory. but doesn't. Here is what i wrote: # a function that mass deletes files in a ...
0
votes
2answers
216 views

Linux Log off Script on Pardus

I'm trying to run a script when user logged out. My linux distribution is Pardus that uses KDE. How can I do this? I've heard about "/.bash_logout" but I couldn't implement that. Where should I ...
1
vote
1answer
312 views

run a shell script on terminal if terminal is idle for few minutes in linux

i can get terminal idle time by w command as follows $ w 14:37:58 up 2 days, 20:16, 2 users, load average: 0.12, 0.16, 0.14 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT ...
0
votes
1answer
1k views

Exited with code: 1 Error with launchd

I am trying to run a job with launchd which runs a shell script that creates a zip file I then backup. I am receiving the error: 6/26/13 5:04:37.992 PM com.apple.launchd.peruser.501[162]: ...
2
votes
2answers
101 views

UNIX-Shell Scripting

While executing the below script, I'm getting an error: Syntax error at line 1 : `(' is not expected. sudo su - user1 -c "cd $HOME ; tar -cvf $HOME/mine.tar `cat /tmp/$LOGNAME/List` " where List ...
0
votes
2answers
527 views

Trying to find any home directory that is writable by anyone

I am trying to locate any user home directories and their files that are writable by anyone. I wrote this: find /home -type d -perm -200 | grep . || echo no world-writable directories here ...
0
votes
1answer
157 views

How to launch X11 program at start up and have it execute custom scripts when the X session is closed?

I need to run a script at the end of each user session, and this seems like the best way to do it. I have no experience making X11 programs, so how exactly do I go about doing this?
3
votes
1answer
518 views

run a bash script at logoff, shutdown, and restart on Linux

I need to run a bash script each time a Debian-esque thick client logs off, shuts down, or restarts. Outside of that, it can be any distro, desktop environment, window manager, or otherwise ...
1
vote
2answers
258 views

How to merge ls commands colors with the output of find or du?

I have a simple alias to list the size of files&folders in cwd. ( including dotfiles in this case , ignoring zero sizes ) du -sh .[!.]* * | sort -hr | grep -v '^0' which can be achieved ...
0
votes
2answers
65 views

How to run my script on VM

I have script on my Virtual machine that i would like to run without []$ ./myscript [studentuser@CentosStudentSvr ~]$ myscript -bash: iduser: command not found otherwise it errors: -bash: iduser: ...
1
vote
1answer
346 views

Capturing output of .bat script in VMWare Fusion 'runProgramInGuest'

I've recently started a new job where we run virtualized copies of Windows inside VMWare Fusion (Mac OSX is the host). Among other things, we have a few utility .bat files that get run regularly. I'd ...
3
votes
1answer
445 views

Delete old log files in AIX

I am trying write a script to delete old log files in \var\log\applog\nmon on my AIX system. We usually get alerts that the file system is almost full and at the moment delete old files by hand. So ...
2
votes
2answers
4k views

Unzip file from source to destination within user directory across multiple versions of windows

I have a source zip file which is located in a user's "My Documents" directory. It is guaranteed to always be there. I'm looking for a way to create a batch or script which will let me unzip that file ...
2
votes
2answers
113 views

Creating unique template HTML files for all MP4 files in a directory

I've prepared a number of video files that will each have their own HTML page. (I'm making a series of lecture videos and trying to keep things simple since I'm a chemist, not a coder.) I'd like ...
1
vote
1answer
227 views

Changing the case of the Nth character of a filename using Bash?

I have a folder of files and I want to change the case of one of their characters at the 5th position. From this: ABC-xyz DEF-xyz GHI-xys To this: ABC-Xyz DEF-Xyz GHI-Xys You'll notice the X ...
0
votes
1answer
143 views

A way to paste predefined list of text in bash script to browser?

I am looking for a way in bash to paste a few lines (which will be selected in a loop) to a form on a webpage at a certain location (i.e to a specific field on a page). Is this possible? Hope I've ...
0
votes
1answer
3k views

Get USB key manufacturer serial number

I am looking for a batch command to retrieve an USB key manufacturer serial number. I need a command that works in both Windows XP and Windows Seven. This is for a hardware follow-up. I have a script ...
0
votes
1answer
45 views

Queue commands to last subshel even if one of them launches new shell

I want to automate something writing simple script launching consecutively few scripts one after another. And then setting some aliases at the top shell. Problem: few of these commands launch new ...
0
votes
3answers
133 views

SSH and SCP giving error

I am doing the same steps (Perform SSH and SCP Without Entering Password on openSSH). But it keep asking password prompt while scp or 'ssh -l' command run. Same steps i did few days back, it was ...
0
votes
2answers
288 views

Auto backup photos to network drive

My wife's ultrabook is getting full of pictures. I have a NAS that all our pictures are on. What I want to do is store EVERY picture on the NAS (easy) but keep all the photos from the last 12 months ...
-2
votes
1answer
274 views

Merging two folders with the same or different names

How can I merge two folders with the same or different names with subdirectories, using shell script or terminal. Also, if there is a file with the same name, then it should skip.
0
votes
1answer
238 views

Can you switch into Single User Mode Without Rebooting?

Is it possible to switch into single user mode WITHOUT rebooting and holding CMD+S. For example, can I write a shell script to switch into single user mode? If so, for which operating systems?
1
vote
2answers
140 views

How to rename to existing folder

i am not able to rename the folder name. i tried these ways. please correct me, [testuser@backupdev1-lnx backup]$ cd /opt/backup/ [testuser@backupdev1-lnx backup]$ ls -l total 8 drwxrwxr-x 2 ...
-1
votes
1answer
29 views

How to perform zipped mirroring on Windows?

My source is a directory hierarchy. I need to auto-copy the files in the source to a destination directory, but to have each file individually zipped inside the destination sub-directories. ...
0
votes
1answer
1k views

Launching a Shell Script via .desktop in Raspbian Wheezy

I am trying to launch OMXplayer and play a sequence of videos on loop on a RaspberryPi running Raspbian Wheezy. I have got a working shell script which launches and plays the videos courtesy of ...
1
vote
1answer
226 views

bad interpreter shell script

Hi I'm trying to write a shell script for plotting with gnuplot however I keep running into the error: bash: ./plot.sh: usr/bin/gnuplot: bad interpreter: No such file or directory I have checked the ...
1
vote
2answers
114 views

Averaging subsets of images with imagemagick, iteratively

I have a hundred images and I want to average them 5 at a time. The imagemagick command for the first 5 is: convert -background transparent %d.jpg[1-5] -average output1.jpg The imagemagick ...
0
votes
1answer
48 views

Script to copy files to x locations of rules are met

I would like to create an automator script that will ask me for a specified folder, and on selection I would like it to search for the following and do x tasks if files is .mkv and does not contain ...
1
vote
3answers
120 views

Linux tool to autodownload and build from SourceForge?

Has anyone made anything (even just a script) to automatically download, untar, and make projects off of SourceForge in Linux? How could I do that? I am using Ubuntu 12.10, specifically.
0
votes
4answers
111 views

Is there a cross OS (win/mac) scripting languagee? [closed]

I use Autohotkey for all my Windows scripting, but would like to use something that could apply to a Mac as well. Without having to write it in multiple languages. And having it compatible with ...