Very strange things happened in the shell function
Here is the script:
Here is the result:
I feel strange about that in the function, the NUM=2080370166, but why out of the function, id get the value, the value changes to "<EOS/> 2080370166"
The output from FindSOS is the output of "grep EOS" plus the output of "echo $NUM".
should fix it. (Or grep -q, if you have a fairly modern grep.)
The use of more | sed is an inventive way of avoiding a Useless Use of Cat Award (google for that), but I certainly would not recommend it.
As another stylistic issue, you could avoid the use of temporary files. Pipes are your friend and you are using them already. A file which only gets used once (by the immediately following command, too) can usually be turned into a pipe.
That while loop looks fairly mysterious, too. You will break out on the first line, correct? So you don't need the magic with $cnt and in fact it will never get executed. The idiomatic way to do that is head -n 1 anyway.
The funny | grep -v '^$' is superfluous too, as long as you are echoing $NUM unquoted, any blanks will be lost anyway.
In one of my shell function I found the following
set_default_values () {
prog=$1
PROC_DT=$2
RESET_ALL="${3-N}"
#echo "Processing date as passed = , Program name = "
......
I understand the first and second arguments, but don't understand... (1 Reply)
I am converting shell script to Perl. In shell I have a code
parse_prog_args()
{
if
then
while
do
case $1 in
-P* | -p* )
export PROCESS_DATE=$2
export MM=`echo $2 | cut -c5-6`
export DD=`echo $2 | cut -c7-8`
export YY=`echo $2 | cut -c3-4`
export... (4 Replies)
I recently bought a new HP Spectre x360 laptop and installed Linux (Ubuntu 16.04 LTS 64 bit) for the first time.
I have noticed a few small bugs but something very strange happens when I shut the laptop lid. The last time I closed it for example, when I re-opened:
The screen resolution had... (0 Replies)
Hi all...
Please help me with this questions.
I am not good at shell scripting.
1) It seems like there are many ways that we can run the shell scripts.
what is the difference between each one?
i)./shell_script.sh
ii).(space)./ shell_script.sh
iii)sh shell_script.sh
... (3 Replies)
I am trying to script up a build of my system from source, and the first couple of steps requires me to do a pull from a CVS mirror three times, and then the script begins.
What I'd like is to be able to do one CVS pull, then start the build of userland, and while userland is building, pull down... (1 Reply)
This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord
but only one record is getting wrote in DB.... Please advise ASAP...:confused:
function InsertFtg
{
FTGSTR=""
echo "Saurabh is GREAT $#"
let... (2 Replies)
Segregated the problematic portion, and showing for your view here.,
1. Following is the function definition,
create or replace function new_del(id integer) returns void as $$
begin
raise info 'dollar :%',$1;
delete from testing where id=$1;
end ;
$$
language 'plpgsql';
... (1 Reply)
Hi all,
I have a pendrive that is fat formatted...
It was being detected so far on solairs...but now during the re-installation of solaris ,i did not remove the drive and guess i screwed it up...
since then , i am unable to use it...guess its now not formatted or is corrupt...
but the irony... (3 Replies)
Hi all,
I am using pthread_cond_timedwait function in my program, to generate the time period of waiting i use gettimeoftheday function.
When i run the code after compiling i get a core dump error. However my program runs perfectly if i give a printf statement before the gettimeoftheday... (1 Reply)
I dual-booted a Pentium 166 with 48mbs of RAM and 2 gig HD between Windows 95 and Redhat 7.
I installed the workstation setup, and selected Gnome as my GUI. Everything went fine, setup was great, no bugs. My monitor is ancient, so it was in the monitor list, and I entered my VRAM as 1mb.
All... (5 Replies)