-1
votes
1answer
31 views

how to retrieve following error when i execute shell script

I have one script to log into remote server.But i tried to Execute the script some error occur. Logs: My script: #!/bin/bash S1=$(ssh -t selvam-odc-shell1 "users | wc -w ") S2=$(ssh -t ...
0
votes
1answer
32 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 ...
1
vote
2answers
54 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" ...
0
votes
2answers
35 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 ...
1
vote
2answers
63 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
54 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 ...
1
vote
1answer
30 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 ...
5
votes
2answers
234 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 ...
2
votes
2answers
354 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 ...
2
votes
4answers
127 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 ...
0
votes
1answer
109 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
1answer
142 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 ...
0
votes
2answers
38 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 ...
1
vote
1answer
360 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 ...
2
votes
2answers
50 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
2k 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' ' ...
2
votes
2answers
85 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 ...
3
votes
1answer
305 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 ...
0
votes
3answers
111 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 ...
1
vote
2answers
119 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
88 views

Elementary Shell Script For Unix

I need help with writing this shell script. Could someone please help me. Thanks. Write a shell script my_echo that accepts an arbitrary number of arguments and prints them, one per line, adding text ...
0
votes
2answers
681 views

running script containing sudo in cron

#!/bin/bash value=$(<man.txt) echo "$value" if [ "$value" == "true" ]; then echo "startedif_manthan" ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9; sleep 30; sudo sh ...
0
votes
1answer
21 views

Cannot start a script

#!/bin/bash value=$(<man.txt) echo "$value" if [ "$value" == "true" ]; then echo "startedif_manthan" ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9; sleep 30; sudo sh ...
0
votes
0answers
25 views

Different behavior from ubuntu server and ubuntu client on windows

#!/bin/bash # Reading cat /home/radiare/Desktop/first.txt | while read LINE do echo $LINE if [ "$LINE" == "false" ]; then echo "Inside first loop" break fi done echo "second file read started" cat ...
1
vote
1answer
118 views

Keeping a Perl script from automatically terminating in terminal

I'm trying to create a shortcut of sorts to a Perl script, by saving a terminal command which launches the script to a .command file. The script is interactive, and allows for the user to interface ...
0
votes
1answer
50 views

Default PYTHONPATH on Mc

I am just getting into Python, and accidentally deleted my default PYTHONPATH. Can someone please tell me what paths are included in a clean Python install? Thanks!
1
vote
3answers
92 views

Find a file in the CWD or any of its parents

I'm trying to create aliases for commands I'm typing a lot. Because I'm working on a big project built on Laravel I need to use the command line tool artisan fairly often. However, I don't often want ...
2
votes
4answers
157 views

Parsing command line output delimited by underscore

I've got some command which output looks like that: some_command Current view: username_token1_token2_token3_4_token4_2 How could I parse the "token3_4_token4_2" part out of the string?
0
votes
1answer
248 views

Determining if an argument looks like a valid path

I'm writing a bash script that needs to perform some operation on an argument which is a path The path may or may not correspond to an existing file on the user's system, so I'd like to test whether ...
3
votes
2answers
370 views

shell script - How to output the owner of a file

Is there a command to output the owner of a file, and nothing else? I suppose I could use ls and run it through sed, but if there is a better way, I would definitely use it. Thanks in advance.
0
votes
2answers
146 views

Shell script: Copy folder with a new name

I'm trying to write this shell script to create in the parent directory a copy of the folders found in the current directory. So far, I wrote this: for folder in *; do mkdir ../$folder; done ...
0
votes
1answer
469 views

Unix shell script - cp -R doesn't copy contents behind symbolic links

I've got this ./image folder full of symbolic links to "real" folders. These "real" folder contain a series of images. ./image/stones -> somefolder/stones ./images/grass -> ...
1
vote
2answers
131 views

Arguments passed on by shell to command in Unix

I've been going over this question and I can't for the life of me figure out why the answer is what it is. How many arguments are passed to the command by the shell on this command line:<pig pig ...
2
votes
3answers
388 views

Batch combine two files in Unix

Does anyone know how to batch prepend one audio file to another audio file and create a separate output for each. E.g. Files: Static.wav Audio1.wav Audio2.wav Audio3.wav I need a script that can ...
2
votes
3answers
135 views

Replacing lines of texts with another in different files in Unix

I have a list of over 200 bind extensions files with exact subdomain information. An example schema looks like this. # /named_ext/db.mysite.com subdomain A 200.201.202.203 ...
1
vote
1answer
69 views

Generating colon seperated path list using find

I am trying to generate some PATH-like directory list, using simple bash- and UNIX commands. I think this one here gives me the output I like to use: $ find /usr/local -type d -exec dirname \{\} \; | ...
6
votes
2answers
66 views

Process files in a folder that haven't previously been processed

I have a series of files in a directory that I need to carry an action out on using a script. Once the action is done, then I want to keep a log that the file has been processed, so that the next ...
2
votes
2answers
709 views

Shell Script, iterating over a folder

I have very basic shell scripting knowledge. I have photos under original folder on many different folder like this folder + folder1 + original + folder2 + original + folder3 + ...
0
votes
1answer
35 views

Creating a link to name changing directory

I have an Ubuntu 12.04 installed using wubi + Win7. I'm trying to create a link to "my documents" directory which located in my C drive: C:\Users\Myuser\My Documents\ Since the Ubuntu is installed ...
4
votes
3answers
3k views

How to replace part of a text file between markers with another text file?

Say I have a text file like this: # custom content section a b ### BEGIN GENERATED CONTENT c d ### END GENERATED CONTENT I'd like to replace the portion between the GENERATED CONTENT tags with the ...
0
votes
1answer
287 views

Using shell script, I need to access a file placed in a location while the script is placed in a different location

I've placed a file in the location /tmp/parent_dir/child_dir/file_1 The script is placed in the location /usr/local/bin/file_load/load_data From this location ...
0
votes
1answer
124 views

dynamically allocating space for variable in ksh

I am new to ksh unix shell scripting.I need my ksh script to get inputs from the user. and the number of inputs is unkown. I need to get the inputs and process again further .The sample run could be ...
-1
votes
2answers
437 views

Create a Shell Service in Ubuntu

I want to create a service, which receives input from a shell script and returns outputs. where should I start, and what to do ? Please give me step by step instruction or reference to one. Thanks.
0
votes
1answer
449 views

Append line length at end of each line

Given input: tree branch the desired output is tree 4 branch 6 What is a *nix available command that does this?
1
vote
1answer
836 views

shell scripting grepping for pattern and then echo message

I have a file which has the below pattern ================================================= 4601 -- it means completed 4602 -- it means failed 4603 -- it means timed out ...
1
vote
1answer
450 views

solaris + egrep command syntax not work

my target is to match snmpmanager string from /etc/hosts file in Solaris machine I don’t get any match output from the following command (but snmpmanager already defined in host file) why?? egrep ...
1
vote
1answer
159 views

Identifying a file with “file” in a shell script?

I'm currently writing a shell script that needs to be able to identify the actual type of files (not their extensions) with the unix "file" utility. However, that tool outputs human readable text ...
0
votes
1answer
442 views

UNIX script to find dirs that contain a specific file (pom.xml) then execute a maven command on it

I'm new to scripting so please bear with me (if you can). I want to do something similar to this question but the 'root' directory will be different for different users on different OS (there can't ...
1
vote
1answer
618 views

How to avoid duplicates when copying files that have been renamed at the destination

I have to get pictures from a folder – with subfolders which are updated automatically – with their extensions. These files have to be copied in a folder where a website based on PHP will edit them ...
1
vote
2answers
1k views

JAVA main class not found when using Apple auto-ingest tool

I am trying to setup a cronjob to download my daily and weekly reports from iTunes Connect. I have downloaded Apple's Autoingestion.class and I have made the following shell script to download the ...