Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help-prompt for path and take this as input in find command Post 302155205 by bsandeep_80 on Thursday 3rd of January 2008 06:16:13 AM
Old 01-03-2008
This is how my program looks can you please tell me why i am getting errors when i run the script as

$./sandeep.sh
./sandeep_new.sh: line 12: read: `dir?what is the path that you want to find ?': not a valid identifier

./sandeep_new.sh: line 13: read: `dir?Please specify a valid path to search ?': not a valid identifier
./sandeep_new.sh: line 23: syntax error near unexpected token `else'
./sandeep_new.sh: line 23: `else'


#!/bin/ksh

NULL=""; export NULL #If the user specifies NULL value

echo "The cvs file script has started............................................"
read dir?"what is the path that you want to find ?"
read dir?"Please specify a valid path to search ?"

if [ "$dir" = "$NULL" ]; then
echo "Not a Valid path or path not specified by user,Do you wish to continue:"[Y/N]?""
read ans
case "$ans" in
y*|Y*)

read log?"Please specify a valid log file(ex:/logs/sandeep.log) that needs to created that will dump the results on the log file ?"

else
n*|N*)
echo exiting from program...;;
esac

if [ "$log" == "$NULL" ]; then
echo "Not a Valid path or path not specified by user,Do you wish to continue:"[Y/N]?""
read ans
case "$ans" in
y*|Y*)

read days?"Please specify the valid number as the number of days for the serach ?"
if [ "$days" == "$NULL" ]; then
echo "Not a Valid path or path not specified by user,Do you wish to continue:"[Y/N]?""

read ans
case "$ans" in
y*|Y*)

find $dir -ctime +$days -type f -exec ls -l {} \; > $log

else
n*|N*)
echo exiting from program...;;
esac


fi
fi

fi



exit

Last edited by bsandeep_80; 01-03-2008 at 07:22 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to prompt for input & accept input in ONE line

hi, am a new learner to shell programming. i have a script which will prompt for user to key in their name & display their name afterwards. script ===== echo "Pls enter your name:" read name echo "Your name is $name." output ===== Pls enter your name: Bob Your name is Bob. what... (2 Replies)
Discussion started by: newbie168
2 Replies

2. UNIX for Dummies Questions & Answers

command to find the path of a file

What is the command to find the path of a file if we know the file name and the root directory where the file resides.. For eg. if a file abc.dat resides in /home/mydir/myfiles/. I am looking for a command which will be fired from / directory, takes abc.dat as input and display the path of... (3 Replies)
Discussion started by: abhilashnair
3 Replies

3. UNIX for Dummies Questions & Answers

create PATH from find command output

I'm trying to autogenerate a PATH variable from the output of a find command as follows: PATH=`find $dir -name "*.jar" | sed 's/$/:/'` The output looks similar like this if I echo it: PATH=/path/to/1.jar: /path/to/2.jar: /path/to/3.jar: I want the path to be on one line. I'm on... (3 Replies)
Discussion started by: rein
3 Replies

4. UNIX for Dummies Questions & Answers

problem with output of find command being input to basename command...

Hi, I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script. I am planning to do like this: if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies

5. AIX

How to find the status of SAN Disc through command prompt

How to find the status of SAN Disc through command prompt (1 Reply)
Discussion started by: AIXlearner
1 Replies

6. UNIX for Dummies Questions & Answers

command to find the absolute path

i understand by using the pwd command we get the present working directory. which command is used to find absolute path from home directory to root.. What is absolute path to your and root user's home directory.:confused::confused::confused: (2 Replies)
Discussion started by: shaziafathima
2 Replies

7. UNIX for Advanced & Expert Users

Entire Input command not visible in Unix prompt

Hi, While typing the Unix command, entire command is not visible.When the input command is long, it is not visible. I want the entire command to be displayed when i type it. Please help to resolve this issue. Thanks Sampath (7 Replies)
Discussion started by: sampath.giri
7 Replies

8. Shell Programming and Scripting

Is it possible to prompt for input if not given on command line?

I have a script built that takes the standard inputs $1 $2 $3 after the name and parses some data. hexsite=`echo "obase=16;$1"|bc` hexfix=$(printf "%.3X" 0x$hexsite) if || ;then type=33 elif || ;then type=59 elif ;then type=99 else type=00 fi cat /directory/*.2012$3*| I am... (8 Replies)
Discussion started by: PCGameGuy
8 Replies

9. Red Hat

How to find the path of a command?

Hi guys. I want to know the path of a command. I tried "which" command also . But no luck. Please tell me how to find and update the correct path of the command. Here I'm unable to find the path of ext2online command # resize2fs /dev/vg01/lvora_backup resize2fs 1.39 (29-May-2006)... (3 Replies)
Discussion started by: vamshigvk475
3 Replies

10. Red Hat

Find command to exclude a specific path

Hi Folks, I want to run the below command and to exclude the specific path like /var/test/support/... . How to achieve using the below command find / -type f \( –perm –4000 –o –perm –2000 \) –print -Siva Please do not use FONT tags inside CODE tags. And, there is usually no reason to... (2 Replies)
Discussion started by: gsiva
2 Replies
OPENSSL_CSR_SIGN(3)							 1						       OPENSSL_CSR_SIGN(3)

openssl_csr_sign - Sign a CSR with another certificate (or itself) and generate a certificate

SYNOPSIS
resource openssl_csr_sign (mixed $csr, mixed $cacert, mixed $priv_key, int $days, [array $configargs], [int $serial]) DESCRIPTION
openssl_csr_sign(3) generates an x509 certificate resource from the given CSR. Note You need to have a valid openssl.cnf installed for this function to operate correctly. See the notes under the installation section for more information. PARAMETERS
o $csr - A CSR previously generated by openssl_csr_new(3). It can also be the path to a PEM encoded CSR when specified as file://path/to/csr or an exported string generated by openssl_csr_export(3). o $cacert - The generated certificate will be signed by $cacert. If $cacert is NULL, the generated certificate will be a self-signed cer- tificate. o $priv_key -$priv_key is the private key that corresponds to $cacert. o $days -$days specifies the length of time for which the generated certificate will be valid, in days. o $configargs - You can finetune the CSR signing by $configargs. See openssl_csr_new(3) for more information about $configargs. o $serial - An optional the serial number of issued certificate. If not specified it will default to 0. RETURN VALUES
Returns an x509 certificate resource on success, FALSE on failure. EXAMPLES
Example #1 openssl_csr_sign(3) example - signing a CSR (how to implement your own CA) <?php // Let's assume that this script is set to receive a CSR that has // been pasted into a textarea from another page $csrdata = $_POST["CSR"]; // We will sign the request using our own "certificate authority" // certificate. You can use any certificate to sign another, but // the process is worthless unless the signing certificate is trusted // by the software/users that will deal with the newly signed certificate // We need our CA cert and its private key $cacert = "file://path/to/ca.crt"; $privkey = array("file://path/to/ca.key", "your_ca_key_passphrase"); $usercert = openssl_csr_sign($csrdata, $cacert, $privkey, 365); // Now display the generated certificate so that the user can // copy and paste it into their local configuration (such as a file // to hold the certificate for their SSL server) openssl_x509_export($usercert, $certout); echo $certout; // Show any errors that occurred here while (($e = openssl_error_string()) !== false) { echo $e . " "; } ?> PHP Documentation Group OPENSSL_CSR_SIGN(3)
All times are GMT -4. The time now is 06:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy