Keep getting error "No such file or directory"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Keep getting error "No such file or directory"
# 1  
Old 02-14-2007
Keep getting error "No such file or directory"

Hi,

When I try to run this script I keep getting the error "/quota.sh: fgrep 5162 /home/nasadmin/quotas_michel/userlist.txt: No such file or directory" but when i run this command typed in I do get the correct output. Can somebody help me?

This is the script:

Code:
# Omgevingsvariabelen instellen
#-------------------------------------------------------------------------------------------
NAS_DB=/nas
NAS_BIN=${NAS_DB}/bin
NAS_SBIN=${NAS_DB}/sbin
PATH=${PATH}:${NAS_BIN}:${NAS_SBIN}
export NAS_DB PATH
REPORT_ROOT=/home/nasadmin/quotas_michel

# datum ophalen
#-------------------------------------------------------------------------------------------
  REPORT_DATE=`date +%D,%T`


# Lijst met gebruikers ophalen
#-------------------------------------------------------------------------------------------
  cat /nas/cifs/usrmapperV3/autoumupload/server_2_newpasswd | cut -d\: -f1,3,5 > userlist.txt

# Lijsten genereren van filesystemen waar quota's op staan
#-------------------------------------------------------------------------------------------


  
        nas_quotas -user -report -fs user1  > user1.txt
        cat user1.txt | while read LINE
        do
                USERID=`echo $LINE | cut -f 2 -d\| | cut -d# -f2`
                USED=`echo $LINE | cut -f3 -d\|`
                SOFT=`echo $LINE | cut -f4 -d\|`
                HARD=`echo $LINE | cut -f5 -d\|`
                UTEMP=`"fgrep $USERID $REPORT_ROOT/userlist.txt"`
        done

# 2  
Old 02-14-2007
Remove the double quotes
Code:
UTEMP=`fgrep $USERID $REPORT_ROOT/userlist.txt`

# 3  
Old 02-14-2007
Removing double quotes loses my variable

If I remove the double quotes I lose the variable.. then the error becomes "fgrep: :: No such file or directory"
# 4  
Old 02-14-2007
can you show trace of your script?
# 5  
Old 02-14-2007
Trace?

Do you meen this with trace?

Code:
[nasadmin@ns600cs_kk4 quotas_michel]$ ./quota.sh
fgrep: for: No such file or directory
fgrep: user: No such file or directory
fgrep: quotas: No such file or directory
fgrep: on: No such file or directory
fgrep: filesystem: No such file or directory
fgrep: user1: No such file or directory
fgrep: mounted: No such file or directory
fgrep: on: No such file or directory
fgrep: /root_vdm_1/user1:: No such file or directory
Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
+------------+---------------------------------+-------------------------------+
fgrep: :: No such file or directory
User
+------------+--------+-------+-------+--------+--------+------+------+--------+
fgrep: :: No such file or directory

+------------+--------+-------+-------+--------+--------+------+------+--------+
fgrep: :: No such file or directory
5003
fgrep: :: No such file or directory
5005
fgrep: :: No such file or directory
5006
fgrep: :: No such file or directory
5007

# 6  
Old 02-14-2007
Add this code at the start of your script and show the trace
Code:
set -vx

# 7  
Old 02-14-2007
trace

Code:
#-------------------------------------------------------------------------------------------
NAS_DB=/nas
++ NAS_DB=/nas
NAS_BIN=${NAS_DB}/bin
++ NAS_BIN=/nas/bin
NAS_SBIN=${NAS_DB}/sbin
++ NAS_SBIN=/nas/sbin
PATH=${PATH}:${NAS_BIN}:${NAS_SBIN}
++ PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/nasadmin/bin:/nas/bin:/nas/bin:/nas/sbin
export NAS_DB PATH
++ export NAS_DB PATH
REPORT_ROOT=/home/nasadmin/quotas_michel
++ REPORT_ROOT=/home/nasadmin/quotas_michel

# datum ophalen
#-------------------------------------------------------------------------------------------
  REPORT_DATE=`date +%D,%T`
date +%D,%T
+++ date +%D,%T
++ REPORT_DATE=02/14/07,11:30:28


# Lijst met gebruikers ophalen
#-------------------------------------------------------------------------------------------
  cat /nas/cifs/usrmapperV3/autoumupload/server_2_newpasswd | cut -d\: -f1,3,5 > userlist.txt
++ cat /nas/cifs/usrmapperV3/autoumupload/server_2_newpasswd
++ cut -d: -f1,3,5

# Lijsten genereren van filesystemen waar quota's op staan
#-------------------------------------------------------------------------------------------


  #for i in 1
  #do
        nas_quotas -user -report -fs user1  > user1.txt
++ nas_quotas -user -report -fs user1
        cat user1.txt | while read LINE
        do
                USERID=`echo $LINE | cut -f 2 -d\| | cut -d# -f2`
                USED=`echo $LINE | cut -f3 -d\|`
                SOFT=`echo $LINE | cut -f4 -d\|`
                HARD=`echo $LINE | cut -f5 -d\|`
                UTEMP=`fgrep \:$USERID\: /home/nasadmin/quotas_michel/userlist.txt`

                #USERNAME=`echo $UTEMP | cut -d: -f1`
                echo $USERID
        done
++ cat user1.txt
++ read LINE
echo $LINE | cut -f 2 -d\| | cut -d# -f2
+++ echo Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
+++ cut -f 2 '-d|'
+++ cut -d# -f2
++ USERID=Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
echo $LINE | cut -f3 -d\|
+++ echo Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
+++ cut -f3 '-d|'
++ USED=Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
echo $LINE | cut -f4 -d\|
+++ echo Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
+++ cut -f4 '-d|'
++ SOFT=Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
echo $LINE | cut -f5 -d\|
+++ echo Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
+++ cut -f5 '-d|'
++ HARD=Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
fgrep \:$USERID\: /home/nasadmin/quotas_michel/userlist.txt
+++ fgrep :Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1: /home/nasadmin/quotas_michel/userlist.txt
fgrep: for: No such file or directory
fgrep: user: No such file or directory
fgrep: quotas: No such file or directory
fgrep: on: No such file or directory
fgrep: filesystem: No such file or directory
fgrep: user1: No such file or directory
fgrep: mounted: No such file or directory
fgrep: on: No such file or directory
fgrep: /root_vdm_1/user1:: No such file or directory
++ UTEMP=
++ echo Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
Report for user quotas on filesystem user1 mounted on /root_vdm_1/user1
++ read LINE
echo $LINE | cut -f 2 -d\| | cut -d# -f2
+++ echo +------------+---------------------------------+-------------------------------+
+++ cut -f 2 '-d|'
+++ cut -d# -f2
++ USERID=+------------+---------------------------------+-------------------------------+
echo $LINE | cut -f3 -d\|
+++ echo +------------+---------------------------------+-------------------------------+
+++ cut -f3 '-d|'
++ USED=+------------+---------------------------------+-------------------------------+
echo $LINE | cut -f4 -d\|
+++ echo +------------+---------------------------------+-------------------------------+
+++ cut -f4 '-d|'
++ SOFT=+------------+---------------------------------+-------------------------------+
echo $LINE | cut -f5 -d\|
+++ echo +------------+---------------------------------+-------------------------------+
+++ cut -f5 '-d|'
++ HARD=+------------+---------------------------------+-------------------------------+
fgrep \:$USERID\: /home/nasadmin/quotas_michel/userlist.txt
+++ fgrep :+------------+---------------------------------+-------------------------------+: /home/nasadmin/quotas_michel/userlist.txt
++ UTEMP=
++ echo +------------+---------------------------------+-------------------------------+
+------------+---------------------------------+-------------------------------+
++ read LINE
echo $LINE | cut -f 2 -d\| | cut -d# -f2
+++ echo '|User' '|' Bytes Used '(1K)' '|' Files '|'
+++ cut -f 2 '-d|'
+++ cut -d# -f2
++ USERID=User
echo $LINE | cut -f3 -d\|
+++ echo '|User' '|' Bytes Used '(1K)' '|' Files '|'
+++ cut -f3 '-d|'
++ USED= Bytes Used (1K)
echo $LINE | cut -f4 -d\|
+++ echo '|User' '|' Bytes Used '(1K)' '|' Files '|'
+++ cut -f4 '-d|'
++ SOFT= Files
echo $LINE | cut -f5 -d\|
+++ echo '|User' '|' Bytes Used '(1K)' '|' Files '|'
+++ cut -f5 '-d|'
++ HARD=
fgrep \:$USERID\: /home/nasadmin/quotas_michel/userlist.txt
+++ fgrep :User : /home/nasadmin/quotas_michel/userlist.txt
fgrep: :: No such file or directory
++ UTEMP=
++ echo User
User
++ read LINE
echo $LINE | cut -f 2 -d\| | cut -d# -f2
+++ echo +------------+--------+-------+-------+--------+--------+------+------+--------+
+++ cut -f 2 '-d|'
+++ cut -d# -f2
++ USERID=+------------+--------+-------+-------+--------+--------+------+------+--------+
echo $LINE | cut -f3 -d\|
+++ echo +------------+--------+-------+-------+--------+--------+------+------+--------+
+++ cut -f3 '-d|'
++ USED=+------------+--------+-------+-------+--------+--------+------+------+--------+
echo $LINE | cut -f4 -d\|
+++ echo +------------+--------+-------+-------+--------+--------+------+------+--------+
+++ cut -f4 '-d|'
++ SOFT=+------------+--------+-------+-------+--------+--------+------+------+--------+
echo $LINE | cut -f5 -d\|
+++ echo +------------+--------+-------+-------+--------+--------+------+------+--------+
+++ cut -f5 '-d|'
++ HARD=+------------+--------+-------+-------+--------+--------+------+------+--------+
fgrep \:$USERID\: /home/nasadmin/quotas_michel/userlist.txt
+++ fgrep :+------------+--------+-------+-------+--------+--------+------+------+--------+: /home/nasadmin/quotas_michel/userlist.txt
++ UTEMP=
++ echo +------------+--------+-------+-------+--------+--------+------+------+--------+
+------------+--------+-------+-------+--------+--------+------+------+--------+
++ read LINE
echo $LINE | cut -f 2 -d\| | cut -d# -f2
+++ echo '|' '|' Used '|' Soft '|' Hard '|Timeleft|' Used '|' Soft '|' Hard '|Timeleft|'
+++ cut -f 2 '-d|'
+++ cut -d# -f2
++ USERID=
echo $LINE | cut -f3 -d\|
+++ echo '|' '|' Used '|' Soft '|' Hard '|Timeleft|' Used '|' Soft '|' Hard '|Timeleft|'
+++ cut -f3 '-d|'
++ USED= Used
echo $LINE | cut -f4 -d\|
+++ echo '|' '|' Used '|' Soft '|' Hard '|Timeleft|' Used '|' Soft '|' Hard '|Timeleft|'
+++ cut -f4 '-d|'
++ SOFT= Soft
echo $LINE | cut -f5 -d\|
+++ echo '|' '|' Used '|' Soft '|' Hard '|Timeleft|' Used '|' Soft '|' Hard '|Timeleft|'
+++ cut -f5 '-d|'
++ HARD= Hard
fgrep \:$USERID\: /home/nasadmin/quotas_michel/userlist.txt
+++ fgrep : : /home/nasadmin/quotas_michel/userlist.txt
fgrep: :: No such file or directory
[nasadmin@ns600cs_kk4 quotas_michel]$ less errorlog.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Beginners Questions & Answers

Grep error "No such file or directory" not solved

Dear all, I run a simple command: grep -f GTEx_snps.txt chr1_r2.txt>chr1_r2_GTEx.txt and got error: "chr1_r2_GTEx.txt: No such file or directory" while "chr1_r2_GTEx.txt is an non-existent file. I google searched some solutions and tried to add -s and --no-messages option grep -s... (2 Replies)
Discussion started by: forevertl
2 Replies

4. Red Hat

Httpd service not starting... Error "Documentroot must be a directory"

I am working with CentOS 6.5. Indeed the document root /var/www/html is a directory and it is a mount point of one file system (not NFS) I observed, if I unmount that file system, I could able to start httpd. Is it restricted in CentOS 6.X that the Documentroot can not be a mount point? ... (5 Replies)
Discussion started by: atanubanerji
5 Replies

5. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

6. Shell Programming and Scripting

mv error " file is not a directory" ?

Hi; This script part: sudo find *.deb -mmin +10 | sudo xargs mv /var/cache/apt/archives/*.* /var/mobile/Library/iFile/Trash/var/cache/apt/archives/ Always returns : " mv: test.deb is not a directory" Any idea what I'm missing ? Thanks in advance: Pasc (2 Replies)
Discussion started by: pasc
2 Replies

7. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

8. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

9. Shell Programming and Scripting

Delete files older than "x" if directory size is greater than "y"

I wrote a script to delete files which are older than "x" days, if the size of the directory is greater than "y" #!/bin/bash du -hs $1 while read SIZE ENTRY do if ; then find $1 -mtime +$2 -exec rm -f {} \; echo "Files older than $2 days deleted" else echo "free Space available"... (4 Replies)
Discussion started by: JamesCarter
4 Replies

10. AIX

AIX cp error: "A file or directory in the path does not exist"

Hello fellow UNIX fans, I'm running AIX 4.3 and getting an error message “cp: /a/file2.db: A file or directory in the path does not exist” when I run the following command: cp /b/file.db /a/file2.db It stops every time about 95% of the way through the copy process at 1,073,741,312 bits. ... (3 Replies)
Discussion started by: Jackson123
3 Replies
Login or Register to Ask a Question