for some reason when i display the array it is not showing the last row in the file.
I wonder why you even get so far. Furthermore, if you have a shell programming problem, it would be appreciated when you could state the shell you are using. It makes reconstructing your environment a wee bit easier.
The first problem is this line:
The shell supports only I/O-buffers 1-9 as far as i know. I changed that to I/O-channel 4 in my verson of your code.
The second problem is this:
This might work in bash, it definitely will not work in ksh, because the "((" has to be surrounded by blanks. Here is my version of your script, which works as expected (at least here):
Hello All,
Request you to let me know how to do the below urgently..
Requirement
File A Contains:
for i in file A
DEV1
DEV5
STG1
STG5
File B Contains:
for j in file B
DEV1
DEV5
STG1
STG5 (3 Replies)
Hi,
I am a beginner in shell scripting. I have written the following script, which is supposed to process the while loop for each line in the sid_home.txt file. But I'm getting the 'end of file' unexpected for the last line. The file sid_home.txt gets generated as expected, but the script... (6 Replies)
So, I want to read line-by-line a text file with unknown number of files....
So:
a=1
b=1
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
done
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
I have written a script to read the file line by line.
It is reading and printing the lines.
But it is coming out of loop before reading last line.
So I am not able to print last line.
How do I solve it. (6 Replies)
Hi Guys
I am new to scripting.Please forgive for asking basic questions.
I want to write a script to check whether the logs are getting updated in last 15 mins.
cat server
192.168.1.6
192.168.1.7
cat list
192.168.1.7 /logs/logpath1
192.168.1.7 /logs/logpath2
192.168.1.6... (4 Replies)
I need some help. I would like to read in a text file.
Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01.
Is this possible? any help is appreciated. (2 Replies)
Hello Team,
i have to read line by line in a while loop, and the input file has:.
# The script will start cppunit test application to run unit tests.
-LD_LIBRARY_PATH=$CPPUNIT_HOME/lib:\
+LD_LIBRARY_PATH=$VOBTAG/SS_UnitTest/lib:\
$VOBTAG/SS_BFD/BFDSCLI/build:\
... (7 Replies)
Hi,
I want to read a live log file line by line and considering those line which start from time stamp;
Below code I am using, which read line but throws an exception when comparing line that does not contain error code
tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Hello,
I'm using RHEL 5.1 with bash. How to handle "read" inside while loop reading every line? Please see below:
# cat /tmp/passwd_sample
CARRJ12:qVSn4ja4mFA72,..:20021:125:JULIAN CARR:/home/everyone:/bin/bash
HERCOT01:NK/3j2ZB4ZC7Q:20022:125:TOM HERCOCK:/home/everyone:/bin/bash... (4 Replies)
Discussion started by: reddyr
4 Replies
LEARN ABOUT DEBIAN
bundle-exec
BUNDLE-EXEC(1)BUNDLE-EXEC(1)NAME
bundle-exec - Execute a command in the context of the bundle
SYNOPSIS
bundle exec command
DESCRIPTION
This command executes the command, making all gems specified in the Gemfile(5) available to require in Ruby programs.
Essentially, if you would normally have run something like rspec spec/my_spec.rb, and you want to use the gems specified in the Gemfile(5)
and installed via bundle install(1) bundle-install.1.html, you should run bundle exec rspec spec/my_spec.rb.
Note that bundle exec does not require that an executable is available on your shell's $PATH.
BUNDLE INSTALL --BINSTUBS
If you use the --binstubs flag in bundle install(1) bundle-install.1.html, Bundler will automatically create a directory (which defaults to
app_root/bin) containing all of the executables available from gems in the bundle.
After using --binstubs, bin/rspec spec/my_spec.rb is identical to bundle exec rspec spec/my_spec.rb.
ENVIRONMENT MODIFICATIONS
bundle exec makes a number of changes to the shell environment, then executes the command you specify in full.
o make sure that it's still possible to shell out to bundle from inside a command invoked by bundle exec (using $BUNDLE_BIN_PATH)
o put the directory containing executables (like rails, rspec, rackup) for your bundle on $PATH
o make sure that if bundler is invoked in the subshell, it uses the same Gemfile (by setting BUNDLE_GEMFILE)
o add -rbundler/setup to $RUBYOPT, which makes sure that Ruby programs invoked in the subshell can see the gems in the bundle
It also modifies Rubygems:
o disallow loading additional gems not in the bundle
o modify the gem method to be a no-op if a gem matching the requirements is in the bundle, and to raise a Gem::LoadError if it's not
o Define Gem.refresh to be a no-op, since the source index is always frozen when using bundler, and to prevent gems from the system leak-
ing into the environment
o Override Gem.bin_path to use the gems in the bundle, making system executables work
o Add all gems in the bundle into Gem.loaded_specs
Shelling out
When shelling out (using the system or backticks methods, for example), Bundler's environment changes will propogate to the subshell envi-
ronment. If you desire to shell out without Bundler's environment changes, simply employ the with_clean_env method. It will restore all
environment variables to what they were before Bundler was activated. For example:
Bundler.with_clean_env do
`brew install wget`
end
RUBYGEMS PLUGINS
At present, the Rubygems plugin system requires all files named rubygems_plugin.rb on the load path of any installed gem when any Ruby code
requires rubygems.rb. This includes executables installed into the system, like rails, rackup, and rspec.
Since Rubygems plugins can contain arbitrary Ruby code, they commonly end up activating themselves or their dependencies.
For instance, the gemcutter 0.5 gem depended on json_pure. If you had that version of gemcutter installed (even if you also had a newer
version without this problem), Rubygems would activate gemcutter 0.5 and json_pure <latest>.
If your Gemfile(5) also contained json_pure (or a gem with a dependency on json_pure), the latest version on your system might conflict
with the version in your Gemfile(5), or the snapshot version in your Gemfile.lock.
If this happens, bundler will say:
You have already activated json_pure 1.4.6 but your Gemfile
requires json_pure 1.4.3. Consider using bundle exec.
In this situation, you almost certainly want to remove the underlying gem with the problematic gem plugin. In general, the authors of these
plugins (in this case, the gemcutter gem) have released newer versions that are more careful in their plugins.
You can find a list of all the gems containing gem plugins by running
ruby -rubygems -e "puts Gem.find_files('rubygems_plugin.rb')"
At the very least, you should remove all but the newest version of each gem plugin, and also remove all gem plugins that you aren't using
(gem uninstall gem_name).
June 2012 BUNDLE-EXEC(1)