Sponsored Content
Full Discussion: Moving files to 'trash'
Top Forums Shell Programming and Scripting Moving files to 'trash' Post 302277853 by Rhije on Sunday 18th of January 2009 12:28:47 PM
Old 01-18-2009
Ok.. hold on.

If and Elif need to have something to test.

ELSE does not, do not put anything to test for, it is saying "If any of the other tests failed.. this is what will be done"

Please put your code in code tags..

Fixing your code, it will look like this:

Code:
if [ $1 ]; then
     echo "Restoring File..."
     mv /home/dustbin/$1 .
elif [$1 "-z" ] ; then
     mv $1 .$2
else
   echo "That file doesn't exist.";
fi

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

moving only files...

hi.. I want to move a set of files that contain a particular string. I wished to do that with find but i am unable to do that. can anybody give me a good method? :) (12 Replies)
Discussion started by: sskb
12 Replies

2. Shell Programming and Scripting

Moving Files

Hi There, I am trying to move files, the file is present in this location: /iAm4Free/test/generate/txt/information.txt I need to move it to: /iAm4Free/test1/generate/txt/information.txt The only difference is the "test" is replaced with "test1". But the constraint is. The parent... (5 Replies)
Discussion started by: iAm4Free
5 Replies

3. Shell Programming and Scripting

Moving files

I wrote a script which moves files on first in first out basis. for i in `ls -ltr | grep ^- | head -10 | awk '{print $9}'` do mv $i Test/ done But donno some reason, this is not working on my Linux box. May i know the reason? Can the above script be done by using positional... (2 Replies)
Discussion started by: venkatesht
2 Replies

4. UNIX for Dummies Questions & Answers

Moving files

Hi I need to be able to move files from one central locations to different servers on our network. So i want all of our operators to place files to one area on the main storage area. From there i need a script that first checks the file is stable (finished copying) then copy to another server,... (5 Replies)
Discussion started by: treds
5 Replies

5. Shell Programming and Scripting

moving the files in a.txt files to a different directory

HI All, I am coding a shell script which will pick all the .csv files in a particular directoryand write it in to a .txt file, this .txt file i will use as a source in datastage for processing. now after the processing is done I have to move and archive all the files in the .txt file to a... (5 Replies)
Discussion started by: subhasri_2020
5 Replies

6. UNIX for Dummies Questions & Answers

Moving Multiple files to destination files

I am running a code like this foreach list ($tmp) mv *_${list}.txt ${chart}_${list}.txt #mv: when moving multiple files, last argument must be a directory mv *_${list}.doc ${chart}_${list}.doc #mv: when moving multiple files, last argument must be a... (3 Replies)
Discussion started by: animesharma
3 Replies

7. Shell Programming and Scripting

Finding files with wc -l results = 1 then moving the files to another folder

Hi guys can you please help me with a script to find files with one row/1 line of content then move the file to another directory my script below runs but nothing happens to the files....Alternatively Ca I get a script to find the *.csv files with "wc -1" results = 1 then create a list of those... (5 Replies)
Discussion started by: Dj Moi
5 Replies

8. UNIX for Dummies Questions & Answers

Moving files..

Selected directories on our system generate alerts when they exceed 60% of the disk space so I have used gzip to make the files smaller on one of the directories in question (AdminServer logs). I want to move these to another directory what is the best way to make this happen? Thanks.. (4 Replies)
Discussion started by: nosuchluck
4 Replies

9. AIX

Moving Hidden files to normal files

I have a bunch of hidden files in a directory in AIX. I would like to move these hidden files as regular files to another directory. Say i have the following files in directory /x .test~1234~567 .report~5678~123 .find~9876~576 i would like to move them to directory /y as test~1234~567... (10 Replies)
Discussion started by: umesh.narain
10 Replies
ASSERT(3)								 1								 ASSERT(3)

assert - Checks if assertion is FALSE

SYNOPSIS
bool assert (mixed $assertion, [string $description]) DESCRIPTION
assert(3) will check the given $assertion and take appropriate action if its result is FALSE. If the $assertion is given as a string it will be evaluated as PHP code by assert(3). The advantages of a string $assertion are less over- head when assertion checking is off and messages containing the $assertion expression when an assertion fails. This means that if you pass a boolean condition as $assertion this condition will not show up as parameter to the assertion function which you may have defined with the assert_options(3) function, the condition is converted to a string before calling that handler function, and the boolean FALSE is con- verted as the empty string. Assertions should be used as a debugging feature only. You may use them for sanity-checks that test for conditions that should always be TRUE and that indicate some programming errors if not or to check for the presence of certain features like extension functions or certain system limits and features. Assertions should not be used for normal runtime operations like input parameter checks. As a rule of thumb your code should always be able to work correctly if assertion checking is not activated. The behavior of assert(3) may be configured by assert_options(3) or by .ini-settings described in that functions manual page. The assert_options(3) function and/or ASSERT_CALLBACK configuration directive allow a callback function to be set to handle failed asser- tions. assert(3) callbacks are particularly useful for building automated test suites because they allow you to easily capture the code passed to the assertion, along with information on where the assertion was made. While this information can be captured via other methods, using assertions makes it much faster and easier! The callback function should accept three arguments. The first argument will contain the file the assertion failed in. The second argument will contain the line the assertion failed on and the third argument will contain the expression that failed (if any -- literal values such as 1 or "two" will not be passed via this argument). Users of PHP 5.4.8 and later may also provide a fourth optional argument, which will contain the $description given to assert(3), if it was set. PARAMETERS
o $assertion - The assertion. o $description - An optional description that will be included in the failure message if the $assertion fails. RETURN VALUES
FALSE if the assertion is false, TRUE otherwise. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.4.8 | | | | | | | The $description parameter was added. The | | | $description is also now provided to a callback | | | function in ASSERT_CALLBACK mode as the fourth | | | argument. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 Handle a failed assertion with a custom handler <?php // Active assert and make it quiet assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_QUIET_EVAL, 1); // Create a handler function function my_assert_handler($file, $line, $code) { echo "<hr>Assertion Failed: File '$file'<br /> Line '$line'<br /> Code '$code'<br /><hr />"; } // Set up the callback assert_options(ASSERT_CALLBACK, 'my_assert_handler'); // Make an assertion that should fail assert('mysql_query("")'); ?> Example #2 Using a custom handler to print a description <?php // Active assert and make it quiet assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_QUIET_EVAL, 1); // Create a handler function function my_assert_handler($file, $line, $code, $desc = null) { echo "Assertion failed at $file:$line: $code"; if ($desc) { echo ": $desc"; } echo " "; } // Set up the callback assert_options(ASSERT_CALLBACK, 'my_assert_handler'); // Make an assertion that should fail assert('2 < 1'); assert('2 < 1', 'Two is less than one'); ?> The above example will output: Assertion failed at test.php:21: 2 < 1 Assertion failed at test.php:22: 2 < 1: Two is less than one SEE ALSO
assert_options(3). PHP Documentation Group ASSERT(3)
All times are GMT -4. The time now is 11:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy