Sponsored Content
Full Discussion: Problems with IF Else ??!!
Top Forums UNIX for Dummies Questions & Answers Problems with IF Else ??!! Post 302471518 by anurag.singh on Saturday 13th of November 2010 09:38:46 AM
Old 11-13-2010
Code:
#!/bin/ksh
echo $1 > fullpath
path1=`awk -F/ '{print $1}' fullpath`
path2=`awk -F/ '{print $2}' fullpath`
if [ "$path1" = "IDS" ]
then
    if [ -d IDS ]
    then
        if [ -d "$path2" ]
        then
        continue
        else
        mkdir ./$path1/$path2
        fi
    else
        mkdir ./$path1
        mkdir ./$path1/$path2
    fi
else 
    if [ -d $path1 ]
    then 
        continue
    else
        mkdir ./$path1
    fi
fi

OR use mkdir -p option
Code:
mkdir -p $1


Last edited by anurag.singh; 11-13-2010 at 10:44 AM..
This User Gave Thanks to anurag.singh For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

'make' problems (compliation problems?)

I'm trying to compile and install both most recent version of 'make' and the most recent version of 'openssh' on my Sparc20. I've run into the following problems... and I don't know what they mean. Can someone please help me resolve these issues? I'm using the 'make' version that was... (5 Replies)
Discussion started by: xyyz
5 Replies

2. UNIX for Dummies Questions & Answers

Few problems

Hi how can i do this? 1) shell script which writes data and time on to a file if filesystem exceeds 70% of space. 2) make entry to cron table to run a script every 15 mins. and can anyone expplain or demonstrate the difference between variables used in inside a function and outside a... (3 Replies)
Discussion started by: vivekshankar
3 Replies

3. UNIX for Advanced & Expert Users

Problems with Last

Hi, I,ve a Unixware 7.1.3 working correctly for two years ago, since a several weeks I've a problem with the command last . The information that this command return is : For example : 1.- The user root , time login : 12:15 h, time logoff 12:15 h (the real time is 14:00). Connected time is... (3 Replies)
Discussion started by: By_Jam
3 Replies

4. UNIX for Dummies Questions & Answers

problems with If

I'm having problems uses "if" it works fine when i do this. #!/bin/sh a= 10 qw= 2 w= 20 { if && ;then echo 3 fi } However if i try to do #!/bin/sh a= 10 (5 Replies)
Discussion started by: THM
5 Replies

5. UNIX for Dummies Questions & Answers

Problems with using less

Hello, I am having problems with using less on Linux version 2.6.18-92.1.17.el5 (brewbuilder@hs20-bc1-7.build.redhat.com) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)). I am using csh but have the same problems on bash. If I pipe something to less it works perfectly i.e. cat file | less... (9 Replies)
Discussion started by: z1dane
9 Replies

6. Shell Programming and Scripting

Problems with $?

Hello, I have the following piece of code that tries to retrieve the result of a .sh: . $HOME/prueba/Scripts/Recogida/recogida_sedra.sh resultado=$? echo "el resultado es : $resultado" if ; then echo "Se va a preprocesar los archivos" In the code of recogida.sh I have the... (8 Replies)
Discussion started by: danietepa
8 Replies

7. SuSE

Problems!!

good friends I am new to linux and I have the following TELNET service problem entering data devo telnet to a Windows server 2003 server and passes will not let me since the move to this server by telnet tells me the characters and thus invalidates me income, I have a service application... (1 Reply)
Discussion started by: pepetico
1 Replies

8. Shell Programming and Scripting

If/then problems

#! /bin/bash # ask what the user would like to do CMD=$CMD MBA=$MB RS=$RS CT=$CT echo echo -n "What would you like to do?? REMEMBER WHEN PROGRAMMING ICP's TO SELECT CORRECT COMMAND ACCORDING TO NECCESSARY TYPE CODE! Please enter a command ct = program ctek ... (5 Replies)
Discussion started by: tdalyman
5 Replies

9. Shell Programming and Scripting

About ps -ef and if-else problems

I'm new in Shell Programming and Scripting, I would like to ask some questions. ps -ef | grep $appNAme | grep -v grep <-- what will it return when it find a process is running? return 1 or 0 if then exit 1 <--- if = 0 , run this ? else continue <--- if = 1 , run this ?... (5 Replies)
Discussion started by: LoAlex
5 Replies
SVN_DIFF(3)								 1							       SVN_DIFF(3)

svn_diff - Recursively diffs two paths

SYNOPSIS
array svn_diff (string $path1, int $rev1, string $path2, int $rev2) DESCRIPTION
Recursively diffs two paths, $path1 and $path2. Note This is not a general-purpose diff utility. Only local files that are versioned may be diffed: other files will fail. PARAMETERS
o $path1 - First path to diff. This can be a URL to a file/directory in an SVN repository or a local file/directory path. Note Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath(3) or dirname(__FILE__). Warning If a local file path has only backslashes and no forward slashes, this extension will fail to find the path. Always replace all backslashes with forward slashes when using this function. o $rev1 - First path's revision number. Use SVN_REVISION_HEAD to specify the most recent revision. o $path2 - Second path to diff. See $path1 for description. o $rev2 - Second path's revision number. See $rev1 for description. RETURN VALUES
Returns an array-list consisting of two streams: the first is the diff output and the second contains error stream output. The streams can be read using fread(3). Returns FALSE or NULL on error. The diff output will, by default, be in the form of Subversion's custom unified diff format, but an external diff engine may be used depending on Subversion's configuration. NOTES
Warning This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. EXAMPLES
Example #1 Basic example This example demonstrates the basic usage of this function, and the retrieval of contents from the stream: <?php list($diff, $errors) = svn_diff( 'http://www.example.com/svnroot/trunk/foo', SVN_REVISION_HEAD, 'http://www.example.com/svnroot/branches/dev/foo', SVN_REVISION_HEAD ); if (!$diff) exit; $contents = ''; while (!feof($diff)) { $contents .= fread($diff, 8192); } fclose($diff); fclose($errors); var_dump($contents); ?> The above example will output: Index: http://www.example.com/svnroot/trunk/foo =================================================================== --- http://www.example.com/svnroot/trunk/foo (.../foo) (revision 23) +++ http://www.example.com/svnroot/branches/dev/foo (.../foo) (revision 27) // further diff output Example #2 Diffing two revisions of a repository path This example implements a wrapper function that allows a user to easily diff two revisions of the same item using an external repository path (the default syntax is somewhat verbose): <?php function svn_diff_same_item($path, $rev1, $rev2) { return svn_diff($path, $rev1, $path, $rev2); } ?> Example #3 Portably diffing two local files This example implements a wrapper function that portably diffs two local files, compensating for the realpath(3) fix and the back- slashes bug: <?php function svn_diff_local($path1, $rev1, $path2, $rev2) { $path1 = str_replace('\', '/', realpath($path1)); $path2 = str_replace('\', '/', realpath($path2)); return svn_diff($path1, $rev1, $path2, $rev2); } ?> SEE ALSO
SVN documentation on svn diff. PHP Documentation Group SVN_DIFF(3)
All times are GMT -4. The time now is 08:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy