UNIX automation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX automation
# 43  
Old 02-02-2011
The corrections I proposed in post #33 were the correct syntax for redirecting the error channel.
Unfortunately the alternative suggestion in post #35 has been applied to the script and the redirection of the error channel is incorrect and is affecting the way the script behaves.
It's all about where the "2>/dev/null" is on the line. It needs to immediately follow the command (in this case "ls").

Quote:
if [ $((ls $i.* | wc -l) 2>/dev/null) -gt 1 ]
filename=$((ls $i.*) 2>/dev/null)
filename2=$((ls *Fe.ok | tail -1) 2>/dev/null)
Also there are too many brackets. We should be evaluating $(command) not the arithmetic syntax $((command)) .
Code:
if [ $(ls $i.* 2>/dev/null| wc -l) -gt 1 ]
filename=$(ls $i.* 2>/dev/null)
filename2=$(ls *Fe.ok 2>/dev/null| tail -1)

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Automation using bots in Linux/UNIX ?

Hi folks, has any one attempted using bots for performing tasks in unix?please share if you faced any challenges thanks (1 Reply)
Discussion started by: tommy812
1 Replies

2. Post Here to Contact Site Administrators and Moderators

UNIX automation

I am using netteza server and i have a list of table names. I need to fetch all the data from these tables and need to create seperate zip files and store in a folder in the server. How can we automate this process. (1 Reply)
Discussion started by: nikhilthms97
1 Replies

3. Shell Programming and Scripting

Unix fdisk -l Automation

Hello Folks - Need help really ASAP. Iam trying to run this Shell command to get all the lists of partitions and disks from across all the servers. #!/bin/ksh _servers="" _out="/tmp/output.$$" _ssh=/usr/bin/ssh >$_out for s in $_servers do $_ssh $s fdisk -l >> $_out done ... (8 Replies)
Discussion started by: bkilaru
8 Replies

4. Homework & Coursework Questions

Mail Automation in UNIX

Hi Sir, I need unix code which will read data present in .xls file and should send an automated mails .when i place the .XLS file in a specific folder and run ***.sh from unix box Attached Excel file contains Subject , To , CC , Body (Paragraph 1) , Body (Paragraph 2) , Signature When i... (2 Replies)
Discussion started by: chaitanyaS
2 Replies

5. Shell Programming and Scripting

creating an automation process in unix .

hi i need shell script in ksh for the automation process in informtica. The automation process is like this . i have a folder in unix . when this folder gets updated (like if a file or files is/are added to the folder) an event in informatica is triggered and after the process is done in... (2 Replies)
Discussion started by: kumar8887
2 Replies

6. Shell Programming and Scripting

Simple Unix Automation

Hi, i'm a newbie with unix and shell scripting. I'm just trying to do a script to simply automate a unix task. This are the steps on what i want to just run on a simple shell script 1. go to a specific path (cd /folder1/folder2/) 2. edit and input a number on a file (file_id) then save exit... (6 Replies)
Discussion started by: soultransit
6 Replies

7. Shell Programming and Scripting

Test automation tool for UNIX ??

I am searching for a automation testing tool which I can use for most of the UNIX platforms (AIX, Linux, HP UX, Solaris). The installation process of the application in all platforms is almost same. Are you aware of any automation tool (like WinRunner for Windows) to solve my problem? (5 Replies)
Discussion started by: unmanju
5 Replies

8. UNIX for Advanced & Expert Users

automation of Informatica jobs using Unix

1.How will you do automation of Informatica jobs using Unix ? 2. How u run workflow from Unix? :) (2 Replies)
Discussion started by: kamesh83
2 Replies

9. Cybersecurity

FTP Automation Windows <> Unix <> Remote

Hi All, I am a newbie to unix and scripting. I need to do the following job: 1. Create a batch file in windows that will call a script in a remote unix box. 2. The script now ftp files from the Remote windows machine and get them back to the local windows. Actually, I have written the script... (3 Replies)
Discussion started by: Ankur
3 Replies
Login or Register to Ask a Question
NoCeM(3pm)						User Contributed Perl Documentation						NoCeM(3pm)

NAME
News::Article::NoCeM - a module to generate accurate nocem notices SYNOPSIS
use News::Article::NoCeM; my $nocem = new News::Article::NoCeM(); $nocem->hide($type, $spam); $nocem->make_notice($type, $name, $issuer, $group, $prefix); $nocem->sign($keyid, $passphrase); $nocem->issue($conn, $ihave); DESCRIPTION
Creates a nocem notice on the Usenet articles, which may be posted normally to hide the messages. USAGE
use News::Article::NoCeM; News::Article::NoCeM is class that inherits News::Article and adds four new functions: hide(), make_notice(), sign() and issue(), redefine to disable two functions: post() and ihave(). Article Methods hide ( TYPE, ARTICLE, [ARTICLE, ...] ) Hide one or more articles in the given "TYPE". "ARTICLE" is an News::Article object that going to be hid. hide() will skip the articles without Newsgroup or Message-ID and skip the ones already hid. hide() returns the number of the articles hid. post ihave post() and ihave() is disabled in News::Article::NoCeM. Please use issue() instead. make_notice ( TYPE, NAME, GROUP, ISSUER, [ PREFIX ] ) Retrive articles marked by hide with "TYPE", and make a notice fot them. If there's only one type within a container, then the container itself can be a notice. "NAME" is the identifier of the issuer. "GROUP" is the newsgroup the you will post nocem notice to. "ISSUER" is the email address of the issuer. "PREFIX" is the announcement before the nocem notice, which may explain the criteria of this notice, or where to find your public key for PGP verification. make_notice() returns a News::Article::NoCeM object if success, and return undef if no article is hid. sign ( KEYID, PASSPHRASE ) Sign the content of the nocem notice with "KEYID" and "PASSPHRASE". Please make sure that the issuer's public/secret keyring is ready. sign() returns a News::Article::NoCeM object if success, and return undef if no article is hid, or pgp_sign failed. issue ( [ CONN, IHAVE ] ) Take optional "CONN" as a Net::NNTP object and issue the nocem notice. "IHAVE" indicates that call Net::NNTP::ihave() for submitting the notice, otherwise issue() will call News::Article::post() by default. issue() return the result of News::Article::post() or issue(). NOTES
Standard article manipulation information can be read in the News::Article manpages. NoCeM FAQ is available on the web at <URL:http://www.cm.org/faq.html>. AUTHOR
Written by Yen-Ming Lee <leeym@leeym.com>, based on a module by Tim Skirvin <tskirvin@killfile.org>. COPYRIGHT
Copyright 2004-2005 by Yen-Ming Lee <leeym@leeym.com>. This code may be redistributed under the same terms as Perl itself. perl v5.12.4 2006-06-23 NoCeM(3pm)