07-30-2019
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am having a variable
Like
line="/dir1/dir2/gr3/file.ksh"
I need to get the /dir1/dir2/gr3 alone. the no of directories may differ at each time.
Please advice. thanks in advance. (3 Replies)
Discussion started by: vanathi
3 Replies
2. Shell Programming and Scripting
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)
Discussion started by: alrinno
2 Replies
3. Shell Programming and Scripting
Hi
I need a script which will remove a path from PATH environment variable. For example
$echo PATH
/usr/local/bin:/usr/bin:test/rmve:/usr/games
$echo rmv
test/rmve
Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
Discussion started by: madhu84
9 Replies
4. Shell Programming and Scripting
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
Discussion started by: royalibrahim
2 Replies
5. Shell Programming and Scripting
Hello Folks,
I want to append a path in user's PATH variable which should be available in current session.
Background
Numerous persons will run a utility.
Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies
6. Shell Programming and Scripting
Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example
start="BEGIN /home/mavkoup/data"
end="END"
sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Discussion started by: mavkoup
4 Replies
7. UNIX for Advanced & Expert Users
I came across a difference between Unix and Linux, when it comes to resolving the symbols from the libs.
consider the following code segments...
$ cat call1.c
#include <stdio.h>
int a1;
extern int a3;
void prnt_a3()
{
printf("\n%d\n",a3);
}
$ cat test.c
#include <stdio.h>... (12 Replies)
Discussion started by: snowline84
12 Replies
8. Shell Programming and Scripting
Hi,
I an having some environment variables exported and the variable name is present in the file. But its not resolving with following commands. Can someone throw some light.
db $ grep -v "^#" TD_FWK_NUCLEUS.dbc | grep -v "^$" | xargs -i echo {}
wb_bin: ${TD_FWK_NUCLEUS_DBC_WB_BIN_TAG}
I... (3 Replies)
Discussion started by: Mohammed Rafi
3 Replies
9. Shell Programming and Scripting
I'm trying to search the 2 pattern in consecutive lines and print them but my variables are not resolving in sed (using bash shell) -
# cat testfile2.txt
Fixing Storage Locations to remove extra slash;
Fixing Storage Locations to remove extra slash;
Fixing Storage Locations to remove extra... (2 Replies)
Discussion started by: Mannu2525
2 Replies
10. UNIX for Beginners Questions & Answers
#!/bin/sh
. /opt/ora/oracle/db/tech_st/11.2.3/PROD_proddb.env
sqlplus -s "username/password" << EOF
no='sqlplus -s username/password<<EOF
set heading off
set feedback off
Select
pt.user_concurrent_program_name report_name , OUTFILE_NAME report_path
FROm
apps.fnd_concurrent_programs_tl... (12 Replies)
Discussion started by: usman_oracle
12 Replies
Mojo(3pm) User Contributed Perl Documentation Mojo(3pm)
NAME
Mojo - Duct tape for the HTML5 web!
SYNOPSIS
use Mojo::Base 'Mojo';
# All the complexities of CGI, PSGI, HTTP and WebSockets get reduced to a
# single method call!
sub handler {
my ($self, $tx) = @_;
# Request
my $method = $tx->req->method;
my $path = $tx->req->url->path;
# Response
$tx->res->code(200);
$tx->res->headers->content_type('text/plain');
$tx->res->body("$method request for $path!");
# Resume transaction
$tx->resume;
}
DESCRIPTION
Mojo provides a flexible runtime environment for Perl real-time web frameworks. It provides all the basic tools and helpers needed to write
simple web applications and higher level web frameworks such as Mojolicious.
See Mojolicious for more!
ATTRIBUTES
Mojo implements the following attributes.
"home"
my $home = $app->home;
$app = $app->home(Mojo::Home->new);
The home directory of your application, defaults to a Mojo::Home object which stringifies to the actual path.
# Generate portable path relative to home directory
my $path = $app->home->rel_file('data/important.txt');
"log"
my $log = $app->log;
$app = $app->log(Mojo::Log->new);
The logging layer of your application, defaults to a Mojo::Log object.
# Log debug message
$app->log->debug('It works!');
"ua"
my $ua = $app->ua;
$app = $app->ua(Mojo::UserAgent->new);
A full featured HTTP 1.1 user agent for use in your applications, defaults to a Mojo::UserAgent object. Note that this user agent should
not be used in plugins, since non-blocking requests that are already in progress will interfere with new blocking ones.
# Perform blocking request
my $body = $app->ua->get('mojolicio.us')->res->body;
METHODS
Mojo inherits all methods from Mojo::Base and implements the following new ones.
"new"
my $app = Mojo->new;
Construct a new Mojo application. Will automatically detect your home directory and set up logging to "log/mojo.log" if there's a "log"
directory.
"build_tx"
my $tx = $app->build_tx;
Transaction builder, defaults to building a Mojo::Transaction::HTTP object.
"config"
my $config = $app->config;
my $foo = $app->config('foo');
$app = $app->config({foo => 'bar'});
$app = $app->config(foo => 'bar');
Application configuration.
# Manipulate configuration
$app->config->{foo} = 'bar';
my $foo = $app->config->{foo};
delete $app->config->{foo};
"handler"
$app->handler($tx);
The handler is the main entry point to your application or framework and will be called for each new transaction, which will usually be a
Mojo::Transaction::HTTP or Mojo::Transaction::WebSocket object. Meant to be overloaded in a subclass.
sub handler {
my ($self, $tx) = @_;
...
}
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojo(3pm)