Samurai Monkey:

OK, it sounds like you have a space at the end of the name of your script. If so, you can rename it like this:

cd begperl mv newline.pl\ newline.pl

Note: that's one space after the \, and then another to separate that file name from the new file name.

Regarding your next question (what is the ls -lb command), you can use man ls to read the man page for the ls command. When you do so, it should show something like this:

LS(1) User Commands + LS(1) NAME ls - list directory contents SYNOPSIS ls [OPTION]... [FILE]... DESCRIPTION List information about the FILEs (the current directory by defa +ult). Sort entries alphabetically if none of -cftuvSUX nor --sort. Mandatory arguments to long options are mandatory for short opt +ions too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print C-style escapes for nongraphic characters --block-size=SIZE use SIZE-byte blocks. See SIZE format below

As you can see above, the -b switch tells ls to put C style escapes in the file names where required. Perl and C escapes are basically the same, and since you didn't report any characters after the \, I guessed that it was a space. Here's a simple program to generate a file with a name with escapes in it:

#!/usr/bin/perl -w open my $FH, '>', "test\ \r\x1b" or die; print $FH "foo\n"; close $FH;

After I run it, I next run ls -alb to get:

$ ls -alb total 2 drwxr-xr-x+ 1 301058 Domain Users 0 2010-12-15 14:14 . drwxr-xr-x+ 1 301058 Domain Users 0 2010-12-15 14:13 .. -rw-r--r-- 1 301058 Domain Users 91 2010-12-15 14:12 foo.pl -rw-r--r-- 1 301058 Domain Users 4 2010-12-15 14:14 test\ \r\033

Then, to delete it, I just type "rm test" and hit the tab key to get the rest of the filename autocompleted for me, and then I press Enter to get rid of the file:

$ rm test\ ^M^[

Note how bash displays a carriage-return as ^M and escape as ^[ while ls -b shows them as \r and \033 respectively.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re^5: perl can't find my script on ubuntu by roboticus
in thread perl can't find my script on ubuntu by Samurai Monkey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.