01-10-2009
Remove the single quotes around $test inside the mkdir call, and it should work fine.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
There is an error when i am trying to use the shift command in this way:
($1 = -d, $2 = 123, $3 = -c etc etc)
for $arg in $@
do
case $arg in
"-d") shift; (so that the $2 will become the $arg now)
(and while it loop the 2nd time,)
... (1 Reply)
Discussion started by: AkumaTay
1 Replies
2. Shell Programming and Scripting
Hi Folks,
In shell scripting the maximum no. of command line parameters becomes 9(Am i right). If we want to get more than 9 parameters we use the shift command.
Even here there are two possibilities.
1. Without the use of variables - The arguments are lost and the lost no. is equal to the... (6 Replies)
Discussion started by: Nisha
6 Replies
3. Shell Programming and Scripting
I am running a program where in I have this command
which is giving error the shift: number is not correct.
can you please tell me how shift actually works?
the line which is giving error is-
set $PARAM; shift; shift; shift; shift; shift; shift; shift; shift
Is it related somewhere to... (2 Replies)
Discussion started by: shrao
2 Replies
4. Shell Programming and Scripting
hi,
another perl question,
I don't understand the below
while (<FILE>) {
push @last5, $_; #add to the end
shift @last5 if @last5 > 5 ; #take from the beginning
}
can someone please explain to me how does
shift @last5 if @last5 > 5 is taking last 5 lines from... (5 Replies)
Discussion started by: hankooknara
5 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I wrote one script, in between script needs to use 10th and 11th positional parameters, that time i used "shift". Here i am facing the below find problem,
./DataCount.sh: cannot shift
I tried
1) I have read man pages for shift
2) Before but * and **
3) Simple shift with out giving... (4 Replies)
Discussion started by: Nagapandi
4 Replies
6. Shell Programming and Scripting
Hey all, I need some assistance. I'm writing a script to eject tapes from a tape library, but the library is not a queued system and can only eject 15 tapes at a time.
I added paste -d : -s so that it goes through full_tapes and puts each media_id on one line separated by the :.
Now I'm... (2 Replies)
Discussion started by: em23
2 Replies
7. UNIX for Dummies Questions & Answers
Hi,
Firstly, I did a search for this question both on this site and on the internet and have not been able to find a suitable answer that is not general in nature.
I have always been a Windows user. I use my girl friend's mac every now and then, but I always come back to windows. For a... (1 Reply)
Discussion started by: mearex
1 Replies
8. Shell Programming and Scripting
Hello Expert
Can any one please explain what is the use of shift command in general terms:
set -- $(ls -t)
shift
rm -Rf $*
what is the use of shift command over here.
Thanks a lot for your help (2 Replies)
Discussion started by: aks_1902
2 Replies
9. Homework & Coursework Questions
Hello everyone,
I am new to Perl and I am having some issues getting a script to work. I have to create a script that uses an array of 52 cards, "shuffles" the cards (using loops with the pop, shift, and push commands), and prints out the top five. This is not a randomizing of the array just a... (2 Replies)
Discussion started by: Hax0rc1ph3r
2 Replies
10. Shell Programming and Scripting
#!/bin/bash
hostname=$1; shift
for hostname in $1
do
ping $hostname
done
I want to run the above script as hostname.sh yahoo.com google.com cnn.com. I want to shift each hostname to $1. How can do that with above code as currently it's not shifting. (5 Replies)
Discussion started by: scj2012
5 Replies
LEARN ABOUT OSX
xml::libxml::nodelist
XML::LibXML::NodeList(3) User Contributed Perl Documentation XML::LibXML::NodeList(3)
NAME
XML::LibXML::NodeList - a list of XML document nodes
DESCRIPTION
An XML::LibXML::NodeList object contains an ordered list of nodes, as detailed by the W3C DOM documentation of Node Lists.
SYNOPSIS
my $results = $dom->findnodes('//somepath');
foreach my $context ($results->get_nodelist) {
my $newresults = $context->findnodes('./other/element');
...
}
API
new(@nodes)
You will almost never have to create a new NodeList object, as it is all done for you by XPath.
get_nodelist()
Returns a list of nodes, the contents of the node list, as a perl list.
string_value()
Returns the string-value of the first node in the list. See the XPath specification for what "string-value" means.
to_literal()
Returns the concatenation of all the string-values of all the nodes in the list.
get_node($pos)
Returns the node at $pos. The node position in XPath is based at 1, not 0.
size()
Returns the number of nodes in the NodeList.
pop()
Equivalent to perl's pop function.
push(@nodes)
Equivalent to perl's push function.
append($nodelist)
Given a nodelist, appends the list of nodes in $nodelist to the end of the current list.
shift()
Equivalent to perl's shift function.
unshift(@nodes)
Equivalent to perl's unshift function.
prepend($nodelist)
Given a nodelist, prepends the list of nodes in $nodelist to the front of the current list.
map($coderef)
Equivalent to perl's map function.
grep($coderef)
Equivalent to perl's grep function.
sort($coderef)
Equivalent to perl's sort function.
Caveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms are passed to the coderef as arguments.
reverse()
Equivalent to perl's reverse function.
foreach($coderef)
Inspired by perl's foreach loop. Executes the coderef on each item in the list. Similar to "map", but instead of returning the list of
values returned by $coderef, returns the original NodeList.
reduce($coderef, $init)
Equivalent to List::Util's reduce function. $init is optional and provides an initial value for the reduction.
Caveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms are passed to the coderef as arguments.
perl v5.16.2 2012-10-22 XML::LibXML::NodeList(3)