Sponsored Content
Top Forums Shell Programming and Scripting Conditional IF statement with a wildcard Post 302549686 by binary-ninja on Tuesday 23rd of August 2011 04:46:42 PM
Old 08-23-2011
Conditional IF statement with a wildcard

I'm trying to create a shell script that will check for new files and or folders and if it exist then copy them to a different directory.

Does anyone have a idea?



Code:
if [ -f /home/upgrade/hex-code/*];
then
    echo "Copying files from the Upgrade Server"
    cp -Ruavp /home/upgrade/hex-code/* /home/bed_mfg1/hex-code/
else
    echo "No new files to copy"
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk conditional statement

how can i use awk or sed to do a conditional statement, so that HH:MM if MM not great than 30 , then MM=00 else MM=30 ie: 10:34 will display 10:30 10:29 will display 10:00 a=$(echo 10:34 | awk ......) Thanks in advance (10 Replies)
Discussion started by: 3Gmobile
10 Replies

2. Shell Programming and Scripting

quoting in conditional statement

can somebody help, what quote i should use in below statement or what wrong of it ? the 1st (*) is a char, the 2nd and 3rd (*) is a wildcard if ] && ] && ] ................^ .............^ then echo "ok" fi thanks in advance. (2 Replies)
Discussion started by: 3Gmobile
2 Replies

3. Shell Programming and Scripting

conditional statement

Hi Does Unix have a conditional statement like Java as follows: Condition ? Statement1 : Statement2 Thanks (8 Replies)
Discussion started by: lalelle
8 Replies

4. Shell Programming and Scripting

conditional statement

Hi all, The following code is to find if a list of numbers from one file are within the range in another file. awk -F, '\ BEGIN { while ((getline < "file2") > 0) file2=$3 } {for (col1 in file2) if ($0>=30 && $1<=45) print $0} ' FILE1 But where I have the number 30 and 45, I... (3 Replies)
Discussion started by: dr_sabz
3 Replies

5. UNIX for Dummies Questions & Answers

Problem with conditional statement

Hi, I'm getting a "bad number" error from the following conditional if statement. I understand the results of the grep command are not being treated a an integer but am unsure of the correct syntax. Any help would be appreciated. if Thanks (2 Replies)
Discussion started by: dlafa
2 Replies

6. Shell Programming and Scripting

if conditional statement

Hi, I have a script like this: sample.sh mapping=$1 if then echo "program passed" fi I'm running the above script as ./sample.sh pass The script is not getting executed and says "integer expression expected" Could anyone kindly help me? (2 Replies)
Discussion started by: badrimohanty
2 Replies

7. Shell Programming and Scripting

if statement with grep as conditional

Please see the script segment below for i in $files do echo $i if ; then case "$1" in "IE0263"|"IE0264"|"IE0267"|"IE0268") short_filename=`ls -l $i | cut -c108-136 | sort` ;; "IE0272"|"IE0273") short_filename=`ls -l $i | cut... (4 Replies)
Discussion started by: jmahal
4 Replies

8. UNIX for Advanced & Expert Users

conditional statement

I need to implement something like this. 1) search for a file(say *.doc) from a path (say /home/user/temp) 2) if file found & if file size > 0 : yes --> file valid else : print file not valid. I am trying to implement something like this, but seems i am terribly wrong somewhere.. ... (1 Reply)
Discussion started by: animesharma
1 Replies

9. Shell Programming and Scripting

Using wildcard in if statement

I'm trying to make a small script to see if you say a specific word, in bash. Here is my code so far : if ]; then echo "You typed Something Device Something" fi exit 0 It does not echo what it should, even if i type something along the lines of "random Device stuff" Please help,... (2 Replies)
Discussion started by: DuskFall
2 Replies

10. Shell Programming and Scripting

conditional statement in awk

Hi all, I have a file containing the values that would be use as the basis for printing the lines of another set of files using awk. What I want to do is something like the one below: stdev.txt 0.21 0.42 0.32 0.25 0.15 file1.txt file2.txt file3.txt ..filen.txt 0.45 0.23 ... (4 Replies)
Discussion started by: ida1215
4 Replies
pki-upgrade(8)							 PKI Upgrade Tool						    pki-upgrade(8)

NAME
pki-upgrade - Tool for upgrading system-wide configuration for Certificate System. SYNOPSIS
pki-upgrade [OPTIONS] DESCRIPTION
There are two parts to upgrading Certificate System: upgrading the system configuration files used by both the client and the server pro- cesses and upgrading the server configuration files. When upgrading Certificate System, the existing system configuration files (e.g. /etc/pki/pki.conf) may need to be upgraded because the content may have changed from one version to another. The configuration upgrade is executed automatically during RPM upgrade. However, in case there is a problem, the process can also be run manually using pki-upgrade. The system upgrade process is done incrementally using upgrade scriptlets. The upgrade process and scriptlet execution is monitored in upgrade trackers. A counter shows the latest index number for the most recently executed scriptlet; when all scriptlets have run, the com- ponent tracker shows the updated version number. The scriptlets are stored in the upgrade directory: /usr/share/pki/upgrade/<version>/<index>-<name> The version is the system version to be upgraded. The index is the script execution order. The name is the scriptlet name. During upgrade, the scriptlets will back up all changes to the filesystem into the following folder: /var/log/pki/upgrade/<version>/<index> The version and index values indicate the scriptlet being executed. A copy of the files and folders that are being modified or removed will be stored in oldfiles. The names of the newly-added files and folders will be stored in newfiles. The system upgrade process is tracked using this file: /etc/pki/pki.version The file stores the current configuration version and the last successful scriptlet index. OPTIONS
General options --silent Upgrade in silent mode. --status Show upgrade status only without performing the upgrade. --revert Revert the last version. -X Show advanced options. -v, --verbose Run in verbose mode. -h, --help Show this help message. Advanced options The advanced options circumvent the normal component tracking process by changing the scriptlet order or changing the tracker information. WARNING: These options may render the system unusable. --scriptlet-version <version> Run scriptlets for a specific version only. --scriptlet-index <index> Run a specific scriptlet only. --remove-tracker Remove the tracker. --reset-tracker Reset the tracker to match the package version. --set-tracker <version> Set the tracker to a specific version. OPERATIONS
Interactive mode By default, pki-upgrade will run interactively. It will ask for a confirmation before executing each scriptlet. % pki-upgrade If there is an error, it will stop and show the error. Silent mode The upgrade process can also be done silently without user interaction: % pki-upgrade --silent If there is an error, it will stop and show the error. Checking upgrade status It is possible to check the status of a running upgrade process. % pki-upgrade --status Troubleshooting If there is an error, rerun the upgrade in verbose mode: % pki-upgrade --verbose Check the scriptlet to see which operations are being executed. Once the error is identified and corrected, the upgrade can be resumed by re-running pki-upgrade. It is possible to rerun a failed script by itself, specifying the instance and subsystem, version, and scriptlet index: % pki-upgrade --scriptlet-version 10.0.1 --scriptlet-index 1 Reverting an upgrade If necessary, the upgrade can be reverted: % pki-upgrade --revert Files and folders that were created by the scriptlet will be removed. Files and folders that were modified or removed by the scriptlet will be restored. FILES
/usr/sbin/pki-upgrade AUTHORS
Ade Lee <alee@redhat.com>, Ella Deon Lackey <dlackey@redhat.com>, and Endi Dewata <edewata@redhat.com>. pki-upgrade was written by the Dogtag project. COPYRIGHT
Copyright (c) 2013 Red Hat, Inc. This is licensed under the GNU General Public License, version 2 (GPLv2). A copy of this license is avail- able at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. version 1.0 Jul 22, 2013 pki-upgrade(8)
All times are GMT -4. The time now is 05:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy