Programming :: Change Current Working Directory Through A Perl Script?

May 2, 2010

how can i actually switch to another directory with "chdir" in perl.like the we used to do is bash as:

Code:
$cat abc
cd Desktop/

[code]...

View 1 Replies


ADVERTISEMENT

Programming :: Perl Script Get Environment Variable LINES= For Current Session?

Apr 1, 2009

Want to return current LINES=, tryng to avoid the "hacky" backticks and string manipulation way

ie: my $somevar = `set | grep LINES`

I tried using the env command and it returns a empty value?

my $lines = $ENV{'LINES'};

$= doesnt work well for putty sessions...

my $lines = $=;

View 6 Replies View Related

Programming :: Perl Script To Look At A Directory For A New File?

Oct 23, 2009

I am new to programming but I am a quick study. I have this script working.

#!/usr/bin/perl
@info=stat("/share/") or die "Can't stat share $!";
while (1) {

[code]...

View 2 Replies View Related

Red Hat / Fedora :: Change The Current Directory To Server And Then Create A Repo?

Feb 6, 2011

I was installing yum from the server folder. first i copied the server folder in a folder which was at root then i change the current directory to server and then create a repo by using following command

Server]# rpm ivh createrepo then tab to get the correct name
then ]# createrepo .
]#cd /etc/yum.repos.d/
]# cp -apr rhel_debug_info.repo yum.repo
]# vi yum.repo

[Code]...

how can i completely install the yum so that i can install my necessary packages

View 1 Replies View Related

Debian Programming :: Using Perl To Replace Filename Strings In A Directory

Jun 12, 2013

I have a directory of orchestral music .ogg files from a family member. Each track is from a different artist and the CDDB entry adds a ":" character after the artist name in the track title.

Here is an example of what I am referring to:

Code: Select all13_-_Mozart:_Sonata_in_A_major_KV_331.ogg

I would like to parse file names in any given directory and search for the string Code: Select all: and replace it with Code: Select all_ According to this post on stackoverflow, I can use Perl to accomplish this task. I've tried Code: Select allperl -i.bak -pe 's/:/_/' but since I am still learning Perl I'm probably commiting a PEBKAC error.

How would I go about solving this issue with regular expressions using Perl?

View 3 Replies View Related

Programming :: Convert Multiple File In Directory - Ascii To Hex In Perl ?

Apr 9, 2011

I have found a perl script that can convert single file: ascii to hex.

However I have thousand of file that I want to convert from ascii to hex.

Here is the perl script that convert single ascii file to hex in single line:

Quote:

So I would like to read multiple file from a directory.

Then the file will be have same name file with hex data.

Here is sample of the read and write directory file.

Quote:

View 3 Replies View Related

Programming :: All The Above Files Are Removed From The Current Directory?

Feb 14, 2011

When I run:make -f mymakefile clean I get:rm -f mybinary *.so.* *.dep *.o mybinary.symand all the above files are removed from the current directory.But I have a directory /src/ where I have all my source files located. The *.o file in this directory are not removed?

View 4 Replies View Related

General :: Show The Current Local Working Directory In Ssh?

Feb 15, 2011

this is gonna be changed to another thread

View 1 Replies View Related

Programming :: Pipe The Current Directory Listing Into Sort?

Oct 20, 2010

how to pipe the current directory listing into sort so that the output is the date in descending order (primary sort key). If there are multiple entries with the same date, I'd like the times sorted in ascending order. It seems simple but for some reason this isn't working:

ls -l | sort -k 6r -k 7

For some reason it doesn't seem to ever get to the second sort key when using column 6 (last modified date).

View 2 Replies View Related

Programming :: List Only Hidden Files In Current Directory?

Feb 15, 2010

How to list only hidden files in current directory ?

View 2 Replies View Related

Programming :: Perl Regular Expression To Change Character

May 26, 2009

Part of a perl script I am writing need to change the character at an index to upper case. Now i am new to perl and i am having some trouble getting it to do it. In c++ i would do something like

Code:

Now from what i understand the same thing is possible in perl using regular expressions. But i cant get it to work.

View 2 Replies View Related

Ubuntu :: Print Current Working Directory In Title Of Xterm?

Jan 29, 2011

In any case what I'm asking it how can I set PWD into my xTerm title bar. I do NOT want pwd at my command prompt because it would make it too long.

View 2 Replies View Related

Programming :: How To Get Perl Qt4 Working

Jul 24, 2010

I really would like Perl Qt4 bindings. The best I could find is this:[URL]The problem is that the sources would not compile, and the RPMs are for 32-bit machines.Is there really no such thing as good Perl Qt4 bindings?

View 8 Replies View Related

General :: Bash History And Keeping Track Of Current Working Directory?

Jun 8, 2010

I would like to keep track of not only what bash commands I used and when, but also where they were issued from, i.e. what was the current working directory when I issued "foobar" on a particular day and time. Can we ask bash history to keep track of working directories too? I have tried to get an idea of this reading the enormous "man bash", but I don't seem to have an answer yet either way.

View 11 Replies View Related

Programming :: Simple Perl Log Code Not Working?

May 25, 2010

I just upgraded servers, and I'm now on 'perl v5.8.8 built for i386-linux-thread-multi' and a simple log script doesn't work. I got it changed to

Code:
#!/usr/bin/perl
use strict;

[code]....

View 4 Replies View Related

Programming :: Perl Script To Count Files And Directories Is Not Working?

Aug 26, 2010

I am new to perl scripting and wrote a perl script to read the directories and files and count the no of files in each directory and generate a log file. The problem is it is not printing anything to the log file. I am copying the script below.

!/usr/local/bin/perl
$dir= 'c:My ProjectsPerl ScriptsNew Folder' ;
$directory_count = 0;
$file_count=0;

[code].....

View 14 Replies View Related

Programming :: Perl - Directories Given To Opendir Via Foreach Give "No Such File Or Directory" Error

Feb 19, 2009

I'm writing a perl script to remove a test database and part of that is of course getting rid of all files. So I wrote this to do the job:

Code:

This always results in an "Could not open /u00/app/oracle/product/10.2.0/rdbms/dbs for reading: No such file or directory" (that directory is the one ending with the $spfile_dir variable) message, although that directory exists and the executing user has writing rights on it.

The same behaviour if I create the directory array like this:

Code:

The problem does not occur when one of the directories is the only element in the array though. Of course I could copy and paste that part of the script for the second directory, but I don't like that workaround.

View 1 Replies View Related

General :: How Is The "Current Working Directory Maintined"

May 25, 2010

I was wondering how the current working directory is maintained in linux. I assumed it would simply be an environment variable, but all attempts i've made to change directory by resetting variables shown by env have failed.Is this something that is maintained internally in the command prompt (bash in my case)?The background to this is I'm setting up a script to remotely run commands over ssh. Since separate commands will unfortunately require separate SSH connections, I need to maintain (save and reload) items such as environment variables and current working directory from one call of the script to the next.

View 4 Replies View Related

Slackware :: Perl 5.12.2 In -current

Jan 2, 2011

Perl 5.12.2 In -current

View 3 Replies View Related

Slackware :: Current: Perl 5.14.0 - DateTime

May 28, 2011

I updated to current, which includes perl 5.14.0. In updating to the latest DateTime module (0.70) via cpan, I receive this:

Code:

Lots of them. The same error occurs when 'make test'ing manually from the DateTime tarball. I see that DateTime 0.70 has been reported to be OK with 5.14.0 on linux (in fact, there are no fails for it). I uninstalled perl, removed all the perl5 directories, reinstalled it, upgraded all the default modules. DateTime still fails like this. Maybe current's perl has been compiled with different options?

View 14 Replies View Related

Ubuntu :: Change The Working Directory Of Script?

Aug 5, 2011

I have a script that should start my Minecraft server. The script is a follows:

#!/bin/bash
java -Xincgc -Xmx1G -jar "/home/jamie/Programs/Minecraft Server/craftbukkit-0.0.1-SNAPSHOT.jar"

The script is located in my scripts directory in my home folder and it is in my path. But when I execute the script the server starts writing all the data to my home folder(The directory I am in). How can I tell the script to change its working directory to the server folder?

View 2 Replies View Related

Programming :: Change Directory In System With Java?

Mar 12, 2011

I am trying to run the configure command to install a package in linux with Java. Now my workspace location of Eclipse project is /home/user/Workspace/projectx. The source package say zebra is located in /project/test/zebra. Now there is a configure script which I want to run using java and all the outout files will also be created in /project/test/zebra.
Now in Java the code I am using runs the configure command but all the files it creates in current workspace of project which is in /home/user/Workspace/projectx directory.
Now as I tried to do 'cd' command but as it's internal command of linux so it doesn't work and I don't know how to make it work. code...

View 8 Replies View Related

Programming :: Source Code For Cd - Change Directory

Feb 9, 2010

I want to modify the source of cd (the 'change directory' command) to do a little extra for me, but I can't seem to find the source code anywhere.. maybe I didn't look for it well enough, and googling "source code cd" and variants of that doesn't exactly help... I was wondering if anyone knew where I could find the src?

View 14 Replies View Related

Programming :: PHP - List Directory - Choose A File - Change Its Name

Mar 16, 2011

Im looking to use PHP to list a directory. When I click on a filename, I'd like it to automatically remove the first 16 characters off of the filename and save it to the filesystem.

View 6 Replies View Related

General :: Using Cp Properly - Copy A Directory Somewhere Else Into This Current Directory ?

May 13, 2011

I am in my current directory. I want to copy a directory somewhere else into this current directory. Lets say I want to take it from direc1/direc2 and the directory I want to take is called demo.

Code:

That is what it shows in the man pages, but when I do that, it says cp: no match

View 5 Replies View Related

General :: Push/pop Current Directory?

Jan 11, 2011

With bash is there a way to push and pop the current working directory? I tried writing bash;cd dir; ./dostuff;exit; but the current directory is now dir.

View 2 Replies View Related

General :: How To Untar To Current Directory

Nov 13, 2010

1. is there a way to prohibit a program from writing data on the hdd?
2. can i have different icons on each gnome workspace and how?
3. how to untar to current directory?
"tar -xvvf blablah.tar.gz" does not work
"tar -xvvf blabla.tar.gz -C ./" does not work
in both cases, the files go into some strange random locations.
4. how can i change the way colors are displayed for different content in the xfce terminal? I used to have red for archives, blue for dirs etc. in kde, but lost all that after changing to gnome.

View 7 Replies View Related

Programming :: Socket Programming In Module Perl

Jul 21, 2010

Where is the perl module for programming with sockets?

View 4 Replies View Related

General :: Copy Everything In Current Directory To Subdirectory?

Aug 25, 2010

How Can I Copy Everything in Current Directory to Subdirectory in linux console

View 6 Replies View Related

Ubuntu :: Set Current Directory As Environment Variable?

Jul 10, 2010

I have a simple shell script name "run.sh".

Code:
export PYTHONHOME="lib/"
python dispatch.py

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved