Search Results

Search: Posts Made By: Joey12
1,127
Posted By Skrynesaver
perldoc DBI will reveal the following snippet ...
perldoc DBI will reveal the following snippet

#!/usr/bin/perl

use strict;
use DBI();

# Connect to the database.
my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost",...
2,811
Posted By Corona688
if["$1-l"] Try if [ "$1" == "-l" ] ...spaces...
if["$1-l"] Try
if [ "$1" == "-l" ] ...spaces and all, you need a space between "if" and "[" for it to work. The same goes for your "-d" statement up there, the spaces are important.
7,708
Posted By Scrutinizer
for filename in "$1"/* do if [ -f...
for filename in "$1"/*
do
if [ -f "$filename" ] && [ ! -e "$filename.old" ]; then
mv "$filename" "$filename.old"
fi
done
7,708
Posted By honglus
No, You don't need loop. either one-liner can do...
No, You don't need loop. either one-liner can do the job.
7,708
Posted By michaelrozar17
could use -v option of grep command to exclude...
could use -v option of grep command to exclude .old files.And those curly braces are important when you append any letter or word (here: .old)

for filename in $(ls * | grep -v '\.old$' 2>...
7,708
Posted By honglus
find $1 -maxdepth 1 -type f -not -name "*.old"...
find $1 -maxdepth 1 -type f -not -name "*.old" -exec mv {} {}.old \;



find $1 -maxdepth 1 -type f -not -name "*.old" | xargs -i{} mv {} {}.old
3,296
Posted By DGPickett
Put the cd and ls in (). cd changes your working...
Put the cd and ls in (). cd changes your working directory, $(pwd) = $PWD, the base of all relative paths.
3,296
Posted By DGPickett
The parentheses mean the cd moves a subshell but...
The parentheses mean the cd moves a subshell but not the parent shell. If you cd dir1; cd dir2with relative paths, you are not in dir2, you are in dir1/dir2 -- you are digging down an imaginary...
3,296
Posted By jim mcnamara
To run in other directories requires that the...
To run in other directories requires that the other directories to be other ( or world) r-x
or r-x for the group you are in.

Most system ( e.g. /usr or /opt) directories are readable.
3,296
Posted By DGPickett
Have you tried diff? I like comm for this...
Have you tried diff?

I like comm for this sort of thing, too.

Cd to the dir in a subshell so the file names are barefoot.
3,296
Posted By DGPickett
Changing directory means any files, including...
Changing directory means any files, including executable files, in the old dir are no longer available without a prefix. If you were and /a/b/ and run c, which is /a/b/c, then when you change dir to...
3,296
Posted By DGPickett
As you are a novice, perhaps you have not grasped...
As you are a novice, perhaps you have not grasped UNIX pathing: file locations can be relative to your current directory $PWD, initially $HOME where you log in, but also absolute (starting with /)....
3,296
Posted By DGPickett
( cd $2 ; ls -ld $file )
( cd $2 ; ls -ld $file )
Showing results 1 to 13 of 13

 
All times are GMT -4. The time now is 05:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy