Dear Unix Guru,
I have several directories as below
/home/user/
dir1
dir2
dir3
Each directory has different size. I want to print each directory size (Solaris command du -hs .)
Can you please guide me how to achieve this?
Thanks
Bala (2 Replies)
I have following problem.
<File A> contains let say 5 lines but can be changed.
cat
dog
fish
car
if I want to add word to each line then how do I go about it?
I used paste -d but that requires two files having same number of lines but
in my case <File A> changes and I just need to... (6 Replies)
I have created a file "pat".This file contains the text "abcdefghi". Now i want to count the characters in this file "pat". I gave wc -c | pat and it returns me exact count "9". Now when i tried like "echo pat | wc -m" It returns '4'. as for as i understand this command "echo pat | wc -m" should... (7 Replies)
I've been looking on the internet, and haven't found anything simple enough to use in my code. All I want to do is count how many times "-" occurs in a string of characters (as a package name). It seems it should be very simple, and shouldn't require more than one line to accomplish.
And this is... (2 Replies)
Hi,
I will use below command for grep single string ("osuser" is search string)
ex: find . -type f | xarg grep -il osuser
but i have one more string "v$session"
here i want to grep in which file these two strings are present.
any help is appreciated,
Thanks in advance.
Gagan (2 Replies)
Hi ,
i'm trying to count a particular word occurance in a whole directory..is this possible :wall:
say for example there is a directory with 100 files which and all the file may have the word 'aaa' in it ...how would i count the number of 'aaa' in those whole 100 files in a directory ?
... (10 Replies)
I have a log directory:
/logs/foo.log
/logs/bar.log
/logs/err.out
I'm trying to find a way to
> /logs/*.log
> /logs/*.out
to blank them out, but of course, that doesn't work.
Any suggestions? (4 Replies)
Hi
Can we run the linux command and per script in a single command
$ cd /usr/local/adm/ ;ctsv scmtest_qabuild ;cspec.pl scmtest
This is a combination of linux and clearcase command and last one is perl script with argument.
I can see the first and 2nd coomand is executing but last... (6 Replies)
Hello everyone,
I am new to Unix and I am stuck with a problem. I need only a single command to display the output of who and then add the total number of users and display at the bottom of that output.
Example-: (Expected output)
sreyan@debian:~$ <command>
sreyan tty7 ... (7 Replies)
can i get a simple script for , Count same word which has come many times in single lines & pars
Eg file would be ==
"Thanks heman thanks thanks
Thanks heman
thanks man"
So resullt should be
Thanks = 5
heman=2
man = 1
thanks in advance :)
Please use code tags for code and... (1 Reply)
Discussion started by: heman96
1 Replies
LEARN ABOUT PHP
set_exception_handler
SET_EXCEPTION_HANDLER(3) 1 SET_EXCEPTION_HANDLER(3)set_exception_handler - Sets a user-defined exception handler functionSYNOPSIS
callable set_exception_handler (callable $exception_handler)
DESCRIPTION
Sets the default exception handler if an exception is not caught within a try/catch block. Execution will stop after the $exception_han-
dler is called.
PARAMETERS
o $exception_handler
- Name of the function to be called when an uncaught exception occurs. This handler function needs to accept one parameter, which
will be the exception object that was thrown. This is the handler signature:
void handler (Exception $ex) NULL may be passed instead, to reset this handler to its default state.
Caution
Note that providing an explicit Exception type hint for the $ex parameter in your callback will cause issues with the
changed exception hierarchy in PHP 7.
RETURN VALUES
Returns the name of the previously defined exception handler, or NULL on error. If no previous handler was defined, NULL is also returned.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.5.0 | |
| | |
| | Previously, if NULL was passed then this func- |
| | tion returned TRUE. It returns the previous han- |
| | dler since PHP 5.5.0. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
set_exception_handler(3) example
<?php
function exception_handler($exception) {
echo "Uncaught exception: " , $exception->getMessage(), "
";
}
set_exception_handler('exception_handler');
throw new Exception('Uncaught Exception');
echo "Not Executed
";
?>
SEE ALSO restore_exception_handler(3), restore_error_handler(3), error_reporting(3), information about the callback type, PHP 5 Exceptions.
PHP Documentation Group SET_EXCEPTION_HANDLER(3)