Sponsored Content
Full Discussion: Script test failing
Top Forums UNIX for Dummies Questions & Answers Script test failing Post 302893747 by SriniShoo on Friday 21st of March 2014 01:07:33 AM
Old 03-21-2014
The error says you are using incorrect ksh path in the first line...but your script shows you are using sh

type the below command and use the first relust in the script

Code:
$ whereis sh
sh: /bin/sh /sbin/sh /usr/share/man/man1p/sh.1p.gz /usr/share/man/man1/sh.1.gz
$ cat usernames.sh
#! /bin/sh
case "$0" in
*/*) cmd="$0";;
*) cmd=`which "$0"`;;
esac
dir=`dirname "$cmd"`
node="$dir/."
echo $node
$

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

UNIX script failing ....

Hi folks, I have written down a UNIX script which actually FTP the file to other server. What is happening now , this script is not working only for 1 server , as it is working for 32 different FTP server . In this particular server , we are getting message “FTp:550 access denied”... (1 Reply)
Discussion started by: khan1978
1 Replies

2. Shell Programming and Scripting

IF condition failing in a SSH script

Hi, I'm ssh-in to a remote machine (ubuntu) and trying to execute a little script in there.The script looks like this: ssh user@ubuntu <<EOF cd ~/test ls -l echo "Continue counting files starting with a`s ?" read answer if then ls -l a* else exit fi EOF Now everything works... (9 Replies)
Discussion started by: rubionis
9 Replies

3. UNIX for Dummies Questions & Answers

failing a unix script

i am basically DWH professional. I want to write a script such that whenver the file size is greather than 0 the script fails plz help me in this (1 Reply)
Discussion started by: er_zeeshan05
1 Replies

4. Shell Programming and Scripting

Script failing on Solaris 10 and working on 8

I have a script and code is like this .. if ]; then it's compiling about @ . what's the wrong in Solaris 10 with this? Thanks (1 Reply)
Discussion started by: talashil
1 Replies

5. Shell Programming and Scripting

Display which test in the if/else is failing

So I have a script that monitors my drives (/dev/sda and /dev/sdb) using smartctl (smartmontools). I'm by no means an expert in scripting, so this was my attempt at creating a way to email me if one of the values in smartctl output goes above a set threshold. My question is, I'm trying to edit... (5 Replies)
Discussion started by: bound4h
5 Replies

6. Shell Programming and Scripting

Expect script help needed- script failing if router unavailable

Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK. However, sometimes an... (3 Replies)
Discussion started by: mrkz1974
3 Replies

7. Shell Programming and Scripting

SCP Failing - In Script

I create a file that may contain several full path name files on a remote Linux that are to be copied. This file, called AWKOUTPUT is created from another script. It contains: X/picture1.png The script is very simple ------------------------------------------- REMOTEDIR="/var/CC/Stuff"... (4 Replies)
Discussion started by: mohrsville12
4 Replies

8. Shell Programming and Scripting

Test file script - if evaluation failing

I have a following script to evaluate if file exist in the directory and then archive it. #!/bin/bash #master directory scriptdir="/flex/sh/interfaces" #change this path only - all other paths are connected with it filedir="/flex/interfaces" #change this path only - all other paths are... (3 Replies)
Discussion started by: viallos
3 Replies

9. UNIX for Dummies Questions & Answers

Crontab script failing

Hello, A crontab script is failiing everyday but when we execute manually it runs fine Below is the script scheduled: 00 23 * * * sh /db2backup/scripts/db2_hot_backup.ksh TRAVFF > /dev/null 2>&1 Error: cat TRAVFF_online_04022014_2300.log Started : Wed Apr 2 23:00:00 EDT 2014... (2 Replies)
Discussion started by: Vishal_dba
2 Replies

10. UNIX for Advanced & Expert Users

PERL DBD make test on Linux failing

I am installing Oracle DBD to PERL 5.16.3 and during make test , I am running into this error :rm -f blib/arch/auto/DBD/Oracle/Oracle.so LD_RUN_PATH="/opt/oracle/product/11.2.0/racdb11204/lib" gcc -m32 -shared -O2 -L/usr/local/lib -fstack-protector Oracle.o dbdimp.o oci8.o -o... (3 Replies)
Discussion started by: talashil
3 Replies
WHEREIS(1)							   User Commands							WHEREIS(1)

NAME
whereis - locate the binary, source, and manual page files for a command SYNOPSIS
whereis [options] [-BMS directory... -f] name... DESCRIPTION
whereis locates the binary, source and manual files for the specified command names. The supplied names are first stripped of leading pathname components and any (single) trailing extension of the form .ext (for example: .c) Prefixes of s. resulting from use of source code control are also dealt with. whereis then attempts to locate the desired program in the standard Linux places, and in the places specified by $PATH and $MANPATH. OPTIONS
-b Search only for binaries. -m Search only for manuals. -s Search only for sources. -u Only show the command names that have unusual entries. A command is said to be unusual if it does not have just one entry of each explicitly requested type. Thus 'whereis -m -u *' asks for those files in the current directory which have no documentation file, or more than one. -B list Limit the places where whereis searches for binaries, by a whitespace-separated list of directories. -M list Limit the places where whereis searches for manuals, by a whitespace-separated list of directories. -S list Limit the places where whereis searches for sources, by a whitespace-separated list of directories. -f Terminates the directory list and signals the start of filenames. It must be used when any of the -B, -M, or -S options is used. -l Output list of effective lookup paths the whereis is using. When non of -B, -M, or -S is specified the option will out hard coded paths that the command was able to find on system. EXAMPLE
To find all files in /usr/bin which are not documented in /usr/man/man1 or have no source in /usr/src: $ cd /usr/bin $ whereis -u -ms -M /usr/man/man1 -S /usr/src -f * FILE SEARCH PATHS
By default whereis tries to find files from hard-coded paths, which are defined with glob patterns. The command attempst to use contents of $PATH and $MANPATH environment variables as default search path. The easiest way to know what paths are in use is to add -l listing option. Effects of the -B, -M, and -S are display with -l. AVAILABILITY
The whereis command is part of the util-linux package and is available from Linux Kernel Archive <ftp://ftp.kernel.org/pub/linux/utils /util-linux/>. util-linux March 2013 WHEREIS(1)
All times are GMT -4. The time now is 06:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy