Leser: 40
1
2
3
4
5
6
var=4
for x in ../*.csv.$( eval expr $var - 1 ); do
new=$(basename $x .$( eval expr $var - 1 ) )
echo cp $x ./$new
done
2009-05-14T07:52:48, mit Anpassungen Linuxer
Code: (dl )1
2
3
4
5var=4
$ for x in ../shared/*.csv.$[var-1]; do
new=$(basename $x .$[var-1])
cp $x ./$new
done
../*.csv.$[var-1]; do
../shared/*.csv.$[var-1]; do
#!/bin/bash
Quotetestskipt.sh: line 5: syntax error near unexpected token `do'
testskript.sh: line 5: `$ for x in ../shared/*.csv.$[var-1]; do '
bash /tmp/dos.sh
1
2
3
4
$ bash /tmp/dos.sh
: command not found2:
'tmp/dos.sh: line 3: syntax error near unexpected token `do
'tmp/dos.sh: line 3: `for x in rimbel; do
1
2
3
4
5
6
7
#!/bin/bash
var=4
$ for x in ../shared/*.csv.$[var-1]; do
new=$(basename $x .$[var-1])
cp $x ./$new
done
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/usr/bin/perl use strict; use warnings; use File::Copy; my $version=4; my $destination_dir='.'; my $source_dir='../ordner'; # Dateien kopieren opendir(my $dirh, $source_dir) or die "Error open $source_dir ($!)\n"; while(my $file=readdir($dirh)) { # wenn die Endung stimmt if($file=~/\.cvs\.(\d+)$/ && $1 == $version-1) { my $source="$source_dir/$file"; my $dest="$destination_dir/$file"; # Punkt und Zahl am Ende entfernen $dest=~s/\.\d+$//; # Datei kopieren. print "$source -> $dest\n"; copy($sorce,$dest) or die "Error copy $source -> $dest ($!)\n"; } } closedir($dirh);
for i in `ls ../ordner/*.csv.*`; do [ ${i##*.} -lt 4 ] && cp $i ${i%.*}; done