Sponsored Content
Top Forums Shell Programming and Scripting Unable to execute find command from inside a shell script Post 303045503 by mohtashims on Saturday 28th of March 2020 08:05:06 AM
Old 03-28-2020
I tried

Code:
#!/bin/bash
/usr/bin/find /app/Jenkins/home/jobs/test1/builds -type d -mtime 1 -exec rm -rf {} \; 
/usr/bin/find /app/Jenkins/home/jobs/test2/builds -type d -mtime 1 -exec rm -rf {} \;

This works and deletes the folders but i get several error messages stating No such file or directory under "/app/Jenkins/home/jobs/test2/builds". Can you please explain why and what is a good approach to avoid such warning messages ?

I'm also curious to learn why exec would work while pipe xargs would not !!

Last edited by mohtashims; 03-28-2020 at 09:13 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute command inside while problem

Hi! How can I execute a linux command inside the while cicle?? like: This doesn't work. Should I replace the by '' or "" (3 Replies)
Discussion started by: ruben.rodrigues
3 Replies

2. Shell Programming and Scripting

deleting files inside shell script - ( using find)

Hi, I am using the command find /apps/qualdb/gpcn/scripts/cab_outbound/archive -name 'z*' -mtime +28 -exec rm {} \; in unix command prompt for deleting the files in my unix system under the specfied folder. It was succesfull. But when i running this command inside a shell script name... (2 Replies)
Discussion started by: Jayaram.Nambura
2 Replies

3. Shell Programming and Scripting

Execute a shell script after a particular command is run

Hi, I need to run a script whenever the Cron file is modified. The requirement is whenever a user modifies the cron file, the script should run automatically. Can you please provide your inputs ? (5 Replies)
Discussion started by: harneet2004us
5 Replies

4. Shell Programming and Scripting

How to monitor a command inside shell script

Hi All, Is there any way to monitor a command inside shell script ? I have a script inside which I have a tar command which zips around 200GB data. tar zcvf $Bckp_Dir/$Box-BaseBackup-$Day.tar.gz * --exclude 'dbserver_logs/*' --exclude postmaster.pid --exclude 'pg_xlog/*' I want to... (3 Replies)
Discussion started by: sussus2326
3 Replies

5. UNIX for Dummies Questions & Answers

Unable to execute the complete cmd - using find command

Hi, I'm unable to execute the below command completely ; it's not allowing me to type the complete command. It is allowing till "xargs" and i cannot even press enter after that. I'm using Solaris. Let me know if anything needs to be added so as to execute the complete command. Appreciate... (12 Replies)
Discussion started by: venkatesht
12 Replies

6. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

7. Shell Programming and Scripting

Can i use if else inside expect command in shell script?

hii,, I am trying to automate jira. during my scripting using bash script, in the terminal i got the terminal message like this: "Configure which ports JIRA will use. JIRA requires two TCP ports that are not being used by any other applications on this machine. The HTTP port is where you... (1 Reply)
Discussion started by: nithinfluent
1 Replies

8. Shell Programming and Scripting

How to find whether a particular command has failed inside an sftp script?

hi, how can i know whether a command inside an sftp script has failed or not? i have a sftp expect script #!/usr/bin/expect spawn /usr/bin/sftp abc@ftp.abc.com expect "sftp>" send "cd dir\r" expect "sftp>" send "mput abc.txt\r" expect "sftp>" send "mput def.xls\r" expect "sftp>"... (5 Replies)
Discussion started by: Little
5 Replies

9. Shell Programming and Scripting

How to execute a command inside a while loop?

How do we execute a command inside a while loop? (7 Replies)
Discussion started by: Little
7 Replies

10. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies
jobs(1) 						      General Commands Manual							   jobs(1)

NAME
jobs - Displays status of jobs in the current session SYNOPSIS
jobs [-l | -p] job_id... [Tru64 UNIX] jobs [-n] job_id... Note The C shell has a built-in version of the jobs command. If you are using the C shell, and want to guarantee that you are using the command described here, you must specify the full path /usr/bin/jobs. See the csh(1) reference page for a description of the built-in command. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: jobs: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Provides more information about each job listed. This information includes the job number, current job, process group ID, state and the command that formed the job. Displays only the process IDs for the process group leaders of the selected jobs. [Tru64 UNIX] Displays jobs that have stopped or exited since last notified. By default, the jobs utility displays the status of all stopped jobs, running background jobs and all jobs whose status has changed and has not been reported by the shell. OPERANDS
Specifies the jobs for which the status is to be displayed. If no job_id operand is given, the status information for all jobs is dis- played. The format of job_id is described in the Jobs section of the ksh(1) reference page. DESCRIPTION
The jobs utility displays the status of jobs that were started in the current shell environment. When jobs reports the termination status of a job, the shell removes its process ID from the list of those "known in the current shell exe- cution environment". See the Jobs section of the ksh(1) reference page. RESTRICTIONS
The jobs utility does not work as expected when it is operating in its own utility execution environment because that environment has no applicable jobs to manipulate. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. ENVIRONMENT VARIABLES
The following environment variables affect the execution of jobs: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: bg(1), csh(1), fg(1), kill(1), ksh(1), sh(1p), wait(1) Standards: standards(5) jobs(1)
All times are GMT -4. The time now is 03:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy