Hi,
I have come across a little strange problem in my script. i tried the same logic in some other script where its working fine. but in other script its not behaving as expected.
Here is the code:
My question is this
1. Why the value is lost of $Count when am trying to print something with it.
2. Is there any problem of data type?
3. What type of datatype is returned by cut command in above?
Here I need to return integer and then to compare them
Count is the number of files, which is specified in a property file from where its picking in above case.
file_count is number of rows in a file.
I need to compare them both and then have to take action further.
Help me out if there is something wrong with data type or logic or something else.
Reference post #1.
It is quite possible that $Count contains a trailing carriage-return character (ctrl/M) such that the "hi" overwrites the number on the screen. This will also mess up your "if" test.
If the data file $FILE_NAME was created on a Microsoft platform, this is quite likely.
Quick fix (though it would be better to fix the data file):
Reference post #1.
It is quite possible that $Count contains a trailing carriage-return character (ctrl/M) such that the "hi" overwrites the number on the screen. This will also mess up your "if" test.
If the data file $FILE_NAME was created on a Microsoft platform, this is quite likely.
Quick fix (though it would be better to fix the data file):
Not sure where the problem is. I can run the script without any issue using the following command.
. /opt/app/scripts/cdc_migration.sh
But it fails with the below error when I try it this way
/opt/app/scripts/cdc_migration.sh
/opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
i have a very strange problem.....i gave the following command on the terminal
sed '15 w temp' f1 -n | temp1=$(awk '{printf $3}' temp) | sed '/'$temp1'/s/1.330000/1.232032/' f1 > f10
where f1, temp and f10 are filenames.
This works sometimes and the same command doesn't work sometimes.... (2 Replies)
The 10.Delete data doesnt work at all, plesase anyone could help on that. When I choose options 10 to delete a record it only copy the selected data on the other file dbs1 but doesnt delete it from the database where other records are.
#! /bin/bash
i="y"
echo "Enter name of database "
read db... (6 Replies)
Hi All,
I am encountering an unexpected problem while running my process, using daemon placed in /etc/init.d/.
I have a process that is opening shared library using dlopen.
When I run my process on the command line, it is able to open the library. But when I used daemon to run my process, I... (0 Replies)
This is probably archaic, but I'm new to unix and this is my first shell script. I'm writing this script to use in another script. All I am trying to do is make the parts of the output from date usable in my other script. I was wondering if you could stand looking at this and see if you notice... (8 Replies)
Well, my script started off to do what i wanted. Now, i think its not recognizing the pattern so its not moving anything.
What i have to do is execute my script command for the move to take effect. So i did that and yayy it worked.
Strange thing is that my DESTDIR was empty to begin with.... (2 Replies)
I'm writing a shell script in which I need to be able to pull a portion of the file name out. I'm testing with the following code:
x="O1164885.DAT"
y=`ls -ltr *${x}|awk '{print substr($0,3)}'`
echo ${x}|awk '{print substr($0,3)}'
echo "y="$y
I can echo it to the screen just fine but I... (3 Replies)
Hi All,
I have one strange problem in perl script. Bellow is the contents of the script i am trying to write:
#!/usr/local/bin/perl
my $module_list = '';
my @running_module;
my $count=0;
my $flag=0;
my $ccprojecthome=$ENV{CCPROJECTHOME};
@module_list = `cat... (2 Replies)
I have installed Fedora Core on a Toshiba Satellite Pro4600 laptop recently I have experienced a rather mysterious problem if I touch anything specially the keyboard or mouse I see this stuff “67yujhnmyyy” straight away some time it won't stop for while like this... (5 Replies)
I did an installation of Redhat 7.1 and it seem to install smoothly. I go and reboot and I get the following message:
"INIT: Id "x" respawing too fast: disabled for 5 minutes"
The screen flashes 4 times every 10 seconds or so.
I can't seem to figure why this does this. It might be a simple... (2 Replies)