Sponsored Content
Top Forums UNIX for Advanced & Expert Users [Discussion] POSIX, the Love of Backticks and All That Jazz Post 302990666 by Scrutinizer on Monday 30th of January 2017 12:13:13 PM
Old 01-30-2017
Any system you will encounter nowadays will most likely contain a POSIX compliant shell. So I would code for that and I really do not see a need for backticks anymore.

There hardly is a reason nowadays why a new script would need to be able to run in a Bourne shell, which would require the backticks..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl - backticks v system in if statements

Can someone explain the difference between backticks and system when evaluated in these if statements: sub getDate { print "start date\n"; if ( system("/bin/date") ) { print "can't get date\n"; exit(2); } print "finish date\n"; } Returns the following: start date Thu... (5 Replies)
Discussion started by: gjkeenan
5 Replies

2. Shell Programming and Scripting

Backticks within backticks?

Hi, I'm trying to do something like this: range= `expr `date '+%m'` - 1` and it does not work. How can I tell it to evaluate an expression within another expression evaluation? I was at first worried that `date '+%m'` would return a string but apparently expr does the math okay normally, so the... (3 Replies)
Discussion started by: jeriryan87
3 Replies

3. UNIX for Dummies Questions & Answers

sed: removing backticks from certain lines

Hi, I would like to change some lines in my mysql-dump, because there a syntax problems with some version of mysql. I 'd like to change USE ´someDatabase´; to USE someDatabase; (without backticks) using the sed command in the shell Thanks & best regards Bernd (5 Replies)
Discussion started by: bjb
5 Replies

4. Shell Programming and Scripting

Am I abusing backticks?

I'm always concerned I might be abusing backticks within my scripts. A current script I'm writing has this for example: stripscriptname=`echo $scriptname | sed 's/\(.*\)\..*/\1/'` stripsearch=`echo $searchpattern | tr -d ' ,/'` Both of these variables are set inside the script (in fact,... (2 Replies)
Discussion started by: mglenney
2 Replies

5. Shell Programming and Scripting

Difference between using xargs and backticks

Hey all. Just a fast question, what is the technical difference between using back ticks and using xargs to perform a command? Here's an example Find /mydir -name *.conf |xargs rm Vs Rm 'find /mydir -name *.conf' Is there a performance hit? I know they do the same thing but which is... (1 Reply)
Discussion started by: msarro
1 Replies

6. Red Hat

perl backticks: can't redirect output.

Hi everyone. This is a bit of a perl/linux mixed question. I am trying to redirect STDOUT of chsh by using the following line of perl code. system ("chsh -s /sbin/nologin $testing 1>/dev/null"); This should redirect STDOUT to /dev/null but it won't do that for some odd reason. Any ideas or... (6 Replies)
Discussion started by: austinharris43
6 Replies

7. Shell Programming and Scripting

Help with remove backticks in a text file

Input file: 'data_1' 'data_10' 'data1311' '235data_13' Desired output: data_1 data_10 data1311 235data_13 Can I know how to remove back tick"'" in a file? Many thanks for advice. (3 Replies)
Discussion started by: perl_beginner
3 Replies

8. Shell Programming and Scripting

SSH and Backticks [solved]

I have been testing a new script and cannot figure out why my `cat spath` will not execute on the remote machine? sudo ssh -p 22344 -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.1.6 "find `cat spath` -depth" cat: spath: No such file or directory but... (0 Replies)
Discussion started by: metallica1973
0 Replies

9. Shell Programming and Scripting

Nesting backticks

I'm trying to make a dialog window that prints the output of grep that takes the output of find. Unfortunately my nested backticks don't work. Here is the dialog window: dialog --stdout --title "test" --backtitle "test" --msgbox "Test:\n `grep -l "${tablica}" `find $string``" 16 60I think I... (2 Replies)
Discussion started by: Starting_Leaf
2 Replies
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 propagate 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). March 2013 BUNDLE-EXEC(1)
All times are GMT -4. The time now is 10:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy