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

learn more… | top users | synonyms (1)

2
votes
1answer
489 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
22 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
47 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
120 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
54 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
54 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
39 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
30 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
59 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
61 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 ...
-1
votes
1answer
2k 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
455 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
36 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
188 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
160 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 ...
0
votes
1answer
101 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
101 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
39 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
413 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
61 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
65 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
83 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
54 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
2answers
323 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
77 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
76 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
1k 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
33 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
48 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 ...
2
votes
2answers
4k views

How to create multiple folders and name them by reading lines from text file?

I have a plain text file named Export.txt. It contains a list of geographical places, preceeded by a 3 digit number with leading zeros. Example --START OF FILE-- 001 Aberdeen 002 Bellevue 003 Camas ...
0
votes
0answers
21 views

Scriptable resize (enlargement) of partition inside LV to end of LV?

I'm trying to automate some KVM installs, and I need to fit an existing image onto a newly created LV. The image is partitioned minimally, so I need a way to enlarge the first partition from the ...
1
vote
1answer
33 views

How to get the path of the newest file among the set of files which contains the same ID?

I want to write a script which will take the ID as an input from the user. Based on that input it will search the directories to match a file which contains the given id. Now, the directory has more ...
0
votes
1answer
77 views

Bash single quotes in find command

I'm having some troubles getting a shell script to work. I'm trying to dynamically generate the find command based on user input and I'm running into the problem that my variables in the find command ...
0
votes
1answer
181 views

How to replace an exact matching word using gsub

Please see the below script - On this nawk 'NR==FNR { a[$1]=$2 ; next} {for ( i in a) gsub(i,a[i])}1' file.dat 1.txt 1.txt ioiufeioru dfoiduf MO_CIF_INP438 fjkdj MO_CIF_INP dsjhdf BP_LINKED_TETES ...
1
vote
1answer
95 views

Send me email everytime a certain file is accessed from my apache server

I want to have my server send me an email every time someone accesses a PDF file on my webserver. Perhaps: tail -f /var/log/apache.log | grep pdf > ??something?? How would I generate a new ...
0
votes
2answers
2k views

How to shutdown ubuntu server from shell script?

I wrote a simple shell script to shutdown an ubuntu server. Then I created a cron job to execute this script at 23:59 everyday. #!/bin/bash sudo shutdown -h now I got this error message: sudo: no ...
3
votes
1answer
1k views

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

Split question: this other one here is for Windows. Linux: Fastest way to disable internet (keeping LAN) from command line? I think the easiest way to deactivate internet (not LAN) in Linux is ...
0
votes
1answer
317 views

ConEmu - running a script in the startup console

I have a script called todo that echoes a todo list to the terminal. I'd like ConEmu to run this every time it starts (thus, in the starting tab). How do I write a task to make it do that? todo is on ...
-1
votes
1answer
416 views

What's needed to have a shell script run via HTTP Post request?

I was wondering what is needed to trigger a shell script with a HTTP post request. Being in my home wifi I want to call http://ip.of.host/req?run and have a script triggered on my host. I guess I have ...
5
votes
2answers
405 views

Bash: How to list n random number of files (not head or tail)

I have a large directory containing numerous files of similar kind. I have to send few random files for auditing. These files should not be from the top or bottom (eg. not in head or tail). This is ...
3
votes
2answers
1k views

scriptdir=`dirname $0` not working

I am trying to get the directory where my script is in by using: scriptdir=`dirname $0` but this gives me the following error: dirname: invalid option -- 'b' Try `dirname --help' for more ...
1
vote
2answers
29 views

How to interrupt my script?

I use the following script (which I start from at command) as an alarm: #! /bin/sh set -m while true; do paplay /usr/share/sounds/phone.wav done & I want to bind a key to stop this alarm. Please ...
1
vote
3answers
2k views

Shell script bash: Moving file iterate based on month

I have very little knowledge about shell scripts, but unfortunately I have to write one. I want to ask about bash script iteration moving files, I need to move log files sorted by month which will be ...
4
votes
1answer
3k views

Bash script gives “command not found” error on if elif statements

Now before you flag this as a duplicate please understand i did search for this problem and i already tried all of the solutions to no effect. My script: #!/bin/bash echo "Enter the number 3" read ...
3
votes
2answers
1k views

Bash script to run “pecl install oci8”

I am trying to create shell script that will do the initial provisioning of a vagrant vm (running Ubuntu 12.04). Everything (installing php, apache, oracle instantclient, etc,) works fine, except for ...
1
vote
1answer
485 views

Unable to run shel scrip file, permission denied

I am having shell script file, basically a setup file for installing xilinx tools. The name of the file is xsetup Also i checked its permission after doing this chmod 777 xsetup In fact the ...
0
votes
1answer
223 views

Cron unable to run shell script

I have been trying to get a shell script to run for hours using cron to no avail. I am trying to have the following bash script run every minute #!/bin/bash ...
0
votes
0answers
50 views

Implement Roll-backing in bash script

I have implemented an Ubuntu package in which bash scripts are using. I followed these for making packages in Ubuntu. ...
0
votes
1answer
90 views

Retrival of read names from fastq file for a particular seq

I have a fastq file.The reads are of length 75bp. This is how a fastq file looks like @ERR030899.2391 HWI-BRUNOP16X_0001:4:1:16426:3738#0/1 ...
-1
votes
2answers
83 views

how to find number of substrings between delimiter? [closed]

I have the string following something(1)^^^something(2)^^^something(3)^^^ ... ^^^something(n) how to find number of something(s) in the string.