Hi,
I am new to Unix, and I am trying to append a line of argument into a current file. I need this line to be inserted into the very top of the file. Does anyone know how this is done?
For example, I am trying: echo "insert to top" >> filename. This inserts the line at the bottom of the... (7 Replies)
say I want to insert "this is a test" as the first line into file A, besides
echo "this is a test" > /tmp/tmpfile
cat /tmp/tmpfile fileA >> /tmp/result,
is there any simple way I can do it? thanks (7 Replies)
Can someone please help me with this SHELL script?
I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1.
Here is a start but I have no clue how to... (3 Replies)
If ($argv == “-debug”) then
Echo “in loop”
Endif
But this is not working. If I modify this code and remove “-“, then it works.
Similarly I am getting problem using grep command also
Grep “-debug” Filename
Can someone please help me on how to resolve these... (1 Reply)
Hello,
Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file
i.e I am workiing on a script which will run through crontab and the script will
chekout the code ,zip and copy to the... (3 Replies)
Hi All,
I am running the script
VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt
result=`cat har1out.mytxt | grep $1'
echo $result
echo $1
{
if
then
echo pass
else
echo fail
fi (2 Replies)
I'm trying to take mrt output and put it at the top of a file along with the date and time. I was able to do it at the bottom of the file with the following
printf "********** $(date) **********\n\n" >> $OUTPUT_PATH/$HOSTNAME
mtr -r -w -c 10 $HOSTADDRESS >> $OUTPUT_PATH/$HOSTNAME
printf... (2 Replies)
Discussion started by: kramer65
2 Replies
LEARN ABOUT OSX
test::trap::builder::systemsafe
Test::Trap::Builder::SystemSafe(3) User Contributed Perl Documentation Test::Trap::Builder::SystemSafe(3)NAME
Test::Trap::Builder::SystemSafe - "Safe" output layer backend using File::Temp
VERSION
Version 0.2.2
DESCRIPTION
This module provides an implementation systemsafe, based on File::Temp, for the trap's output layers. This implementation insists on
reopening the output file handles with the same descriptors, and therefore, unlike Test::Trap::Builder::TempFile and
Test::Trap::Builder::PerlIO, is able to trap output from forked-off processes, including system().
See also Test::Trap (:stdout and :stderr) and Test::Trap::Builder (output_layer).
CAVEATS
Using File::Temp, we need privileges to create tempfiles.
We need disk space for the output of every trap (it should clean up after the trap is sprung).
Disk access may be slow -- certainly compared to the in-memory files of PerlIO.
If the file handle we try to trap using this backend is on an in-memory file, it would not be availible to other processes in any case.
Rather than change the semantics of the trapped code or silently fail to trap output from forked-off processes, we just raise an exception
in this case.
If there is another file handle with the same descriptor (f ex after an "open OTHER, '>&=', THIS"), we can't get that file descriptor.
Rather than silently fail, we again raise an exception.
Threads? No idea. It might even work correctly.
BUGS
Please report any bugs or feature requests directly to the author.
AUTHOR
Eirik Berg Hanssen, "<ebhanssen@allverden.no>"
COPYRIGHT & LICENSE
Copyright 2006-2012 Eirik Berg Hanssen, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.2 2013-08-25 Test::Trap::Builder::SystemSafe(3)