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

learn more… | top users | synonyms (1)

0
votes
1answer
16 views

Command in script fails with “not found” error, but runs fine on command line

I've created a minimal environment on my embedded ARM device consisting of just the Linux kernel, and with Busybox and a minimal filesystem in an initrd image. I have an inittab that runs ...
0
votes
1answer
19 views

Keep only latest two folders in the directory

I have a directory which has the following folders. Data-2014-07-10-0240 Data-2014-07-10-0340 Data-2014-07-11-1232 Data-2014-07-12-0530 Data-2014-07-13-1210 I want to keep only latest two folders ...
0
votes
0answers
13 views

Copy all files except those that are executable [duplicate]

I have a backup script that copies all the files in my programming directory to an external HDD. Right now, the output files are called program.out and my script is set to ignore them, but I would ...
0
votes
1answer
24 views

sh + how to run command and set it into parameter ( VAL )

please take look on the following commands down, ( the shell is sh ) something not clearly for me when I run - eval echo \$arr$n , I get the value a as expected so why: VAL=eval echo \$arr$n , ...
1
vote
1answer
38 views

Finding subdirectories in linux

I am trying to search through all the subdirectories in the current directory for a directory named 'jdk1.7'. I have written a statement like find -type d -name 'jdk1*' But I am not getting any ...
0
votes
2answers
45 views

List of MAC addresses for 10 machines

I need to list of MAC addresses for a 10 computers having Windows 7 installed on them. These are named in a series like training1 - training10. There IP addresses are on DHCP mode and update every ...
0
votes
0answers
20 views

I need a dynamic script for changing Host IPs depending on computer name that I can shoot over the network

Does anyone know how to make a Batch/Script, that I can modify, for looking up the host computer name and build the IP and gateway off of it. we have a simple setup of computer name refers to ...
0
votes
1answer
45 views

how to batch change date created to date modified

I have many video files ending with extensions mov, avi, mp4, and mts. I need to change their "date created" to their "date modified value" I tried using the following powerhsell script: ...
0
votes
1answer
51 views

Run a script only at shutdown (not log off or restart) on Mac OS X

Is there any way to run a script only at shutdown? I mean, only when the computer is really shutting down to off state. This script should not run when doing just a log off or restart.
0
votes
1answer
14 views

Backing up github [closed]

I have a bunch of github directories and have been using a script with the "cp" command to backup to an external USB drive. I was wondering if I should be backing up directories that I make for ...
0
votes
0answers
9 views

unable to terminate the program via using function in shell

I have two files 1.sh and 2.sh below is the code of both files. 2.sh is main file which is executing and 1.sh is used for defining the functions. 1.sh function logging_function() { STATUS=$1 ...
0
votes
2answers
44 views

How can I read out internal pdf creation/modified date with Windows PowerShell?

PDF files seem to have a separate set of file properties which contain (among others) a creation date and a modified date (see screenshot here: ...
1
vote
2answers
46 views

CURL used in shell

I am executing a shell script in which one curl command is present. I have to store the output of curl command(xml format) in a file and display the result on screen. For this to happen "tee command" ...
1
vote
1answer
40 views

How to wake-up remote IIS webserver using dd-wrt shell scripting

The problem: I have some asp.net websites hosted on IIS ( at a local hosting company). Now if nobody access them during aprox. 20 minutes, the IIS is going into sleep mode, so the first next request ...
1
vote
2answers
45 views

Not able to copy a file via script from local host to remote host

I am trying to write a script that can copy a file from local host to remote host. And then i want to execute that script from local host. But I am not able to copy. I googled and found the below ...
0
votes
1answer
45 views

How to call a Windows Environment Variable in a Shell script?

It is possible to call Windows Environment Variables in a bat script by defining e.g. %JAVA_HOME%. It looks like this is not possible using CygWin and shell scripts. Is it possible to call Windows ...
0
votes
1answer
53 views

Execute the shell command in subshell or in background?

Actually I mainly work with Ruby, but now I have created a bash script file. From this script file I am displaying the messages on the screen. Here is my scenario. I have used aosd_cat module for ...
0
votes
1answer
43 views

How do I call function after prompt for input in a Linux shell script?

The title says it all. After Im prompted, I want yes and no to respectively call a function. # Check to see if you ran this script before echo echo I need to know if this is your first time... while ...
0
votes
1answer
72 views

Shell script to check all the URLs from a file or list

I'm looking for a shell script to check a list of URLs and give output. For example: http://abc.com/index.php http://abc1.com/index.php I may place them in a separate file or inside the script. I ...
2
votes
1answer
48 views

How to make a service start in SUSE Enterprise linux

I created a app and the service file , You can start / stop / restart the service ... I want to start that service at the time of booting of Suse Enterprise linux , I tried adding that file in ...
0
votes
0answers
12 views

Determine missing files after XML to Json conversion

I want to do some analyses on this files, using a big data approach. After converting my entire Batch of Files from XML to JSON (Over 100k Files, divided in 2 Folders) I realized that in the first ...
1
vote
1answer
30 views

SSH/Wget and port redirection

Platform: Ubuntu 12.04 There is a internal web server that's behind firewall. I have ssh permissions to connect and redirect the port. I normally use ssh port redirection and point my browser to that ...
3
votes
3answers
104 views

How to format my text file for better appearance?

I want to format my text file for better appearance. So I want any command or any shell script which will format my file as per my expectation. Input File: Index Name City 1. Ravi Bhuva Ahmedabad 2. ...
-1
votes
1answer
47 views

Copy one directory to another while retaining its structure

Let's assume I have the following source directory: source/ subdir1/file1 subdir1/file2 subdir2/file3 subdir3/file4 And target directory: target subdir1/file5 subdir2/file6 ...
2
votes
1answer
46 views

Start the script with sudo

I am trying to start the virtual machine(ORACLE VIRTUALBOX) using this script(script name:start_vm001.sh). START_VM=`/usr/bin/VBoxHeadless --startvm testvm001` EXECUTE_VM=`exec ...
0
votes
1answer
31 views

Ignoree a specific file in file count “wc -l”

e.g. I have directory like ABC. And this directory contain following files (it contain number of files i just include 4 fils here) 2014-04-29T06-19-20_17368f93ce.mp4.uploaded ...
0
votes
2answers
27 views

Find particular file from extension from particular directory

I want to find a particular filename from a particular directory. Also I don't know the file name on that particular directory. I only know the extension of that file i.e. ".uploaded". So using that ...
1
vote
1answer
35 views

How to recursively create a directory if it does NOT yet exist?

This seems like a general utility and am wondering if anything already exists. I'm trying to place a timestamped logfile in a directory after a script runs, but need to make sure the subdirectory ...
1
vote
1answer
25 views

Need help in the shell script - gunzip and file command

This is on Ubuntu 12.04. I have a custom webkit based application where "browser" saves bunch of cache files. When triaging the problems, I have to inspect the cache. The cache directory holds many ...
-2
votes
1answer
409 views

Shell files (*.sh) to batch file (*.bat) converter?

It's quiet tedious to convert shell scripts into batch files. Is there a way to automatically and easily perform .sh to .bat conversion or vice versa?
1
vote
1answer
84 views

Windows command-line: Fastest way to disable internet (keeping LAN)?

Split question: this other one here is for Linux. I think the easiest way to deactivate internet (not LAN) in Windows command-line is to remove the default gateway, so, assuming LAN is ...
0
votes
2answers
34 views

Inserting a linebreak in lines starting with a pattern

I have a huge file that has the following format: #pair: 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 ...
0
votes
1answer
47 views

Shell script not running with cronjob

I am using PUTTY to reach the server. I can dump the databases with the following command: /usr/bin/mysqldump --all-databases | /bin/gzip > Backup_DB/alldatabases_test.sql.gz When I am running ...
0
votes
1answer
36 views

running for loop - but wait for string of words in log file to continue

so far I have this: for each in {01..10} ; do ./sb0$each/tomcat_sb0$each start;done that will start my apps at once, but I want it to wait until it reads one line in a file, what's the easiest way ...
1
vote
2answers
60 views

Monitoring Excessive User Home Directory Growth

I am trying to write a script for a school assignment that will check and see if any of the non-administrative user home directories have increased in size by more than 100 MB in a single 20 minute ...
0
votes
1answer
69 views

Cannot unzip with zip command line

I am having difficult unpacking a zip to a specific directory. I am trying to get all contents of subdirectory of the zipped file and not the parent directory. This is parent directory within zip ...
0
votes
1answer
50 views

Unix Scipt Shell: alert on change of specific files

Could any one Help me with the script Im trying to make a script shell that will alerts/email the root if any of those files has been modified and the script has to auto routine , so the script have ...
0
votes
1answer
18 views

alias can't find a file that actually exists

On my personnal computer, not a server, in my .bash_profile (I'm on OSX) — sym-linked to .bashrc, I have the following line among some others : alias deploy=sh ~/dir/ectory/deploy.sh The file ...
-1
votes
1answer
61 views

how to run a shell script on git commit

1) i have a shell script which basically contains some(database testing and integrating test code) , but i have to run this shell script when ever there is commit (or any change ) in my git repo the ...
1
vote
1answer
34 views

How do I identify shell script execution vs dot execution

I'm writing a bash script that needs to run on the current process for it to be useful. That is, I want to make sure that the script was invoked with source script.sh or . ./script.sh and not ...
0
votes
0answers
35 views

Tools to create a 'GitHub' style index page for files/folder on a fileserver?

My workplace doesn't have a document management system. People just throw files on a shared fileserver, where search doesn't really work. Trying to find information/files for a particular project by ...
1
vote
1answer
61 views

I want to read a value from a text file and compare it with a number

I am using windows powershell. I want to retrieve a number which is stored in a text file and compare it with some other number using a shell script. If I use $x=$(cat value.txt) it says "command not ...
2
votes
1answer
34 views

Loop thru tar file and run commands on each file

I have a process of extracting new code to my servers where the code is packaged in a tar file. Each file referenced in the tar is backed up to a specific directory. I'd like to automate this process ...
0
votes
0answers
14 views

(MAC) Change location of shell script's shell

When I make an executable shell script ("http://chimpy.wordpress.com/2010/08/29/mac-os-x-shortcut-link-to-python-script/", but without the python part), It's pointer location (The location commands ...
0
votes
2answers
77 views

curl shell command always returns error status 0 - even when fails on input errors

Example: trying to upload a non existing file - curl -d @no-real-file http://google.com | echo $? - returns 0. How can I make curl fail on input errors?
1
vote
1answer
51 views

what does =~ in linux means used in if condition to compare values

Actually tomcat/conf/catalina.properties file contains line shared.loader=/usr/share/sfit/conf I mean value has some path. so using shell script we are updating shared.loader values in file. And also ...
0
votes
2answers
32 views

I want to find out word which ends with ()…Use grep

I want to find out word which ends with ()...Using the grep command in linux. grep file_name_where_i_want_to_search "*()" some thing like that....but its not working
2
votes
1answer
372 views

Using wildcards in scp command

I have a bash script which copies several files to a remote server using scp. This script works fine but now I need to add a file that contains a wildcard in the name and i have a problem with it. ...
0
votes
0answers
25 views

Start program from shellscript in background then bring back to foreground later

I'm trying to make a shell script that does the following: Start program ~/x While x is running execute some commands, for example: echo "blabla" >> ~/blabla.txt After the execution of those ...
3
votes
1answer
43 views

Greatest number in a column using shell script

I have a file that contains some data in column format, for example: 219m 219m 3.9g 3.9g 4.0g 4.0g 4.1g 4.1g 4.2g 4.2g 4.2g I want to compare the data and find the greatest value of these. Here g ...