Is there some requirement to use exec on the iphone OS? What if you tried leaving that off? Normally, exec is rarely or never required.
---------------------------
Doesn't make sense. "After:" (from file *) shows six files / dirs. The ls shows nine. Doesn't add up. Try doing ls -l to help figure out what the difference is, why three .x dirs supposedly show up in one listing, not the other.
If the Before: situation already has both Ac and Ac.deb.x directories, then when mv Ac.deb.x Ac runs, it does not rename Ac.deb.x to Ac, but instead moves Ac.deb.x to be a subdirectory of the existing Ac directory. The script assumes that the renamed directories do not already exist.
Code:
$ file *
dir: directory
dir.deb.x: directory
file.deb.x: ASCII text
$ ls dir
$ mv dir.deb.x dir
$ file *
dir: directory
file.deb.x: ASCII text
$ ls dir
dir.deb.x
Taking into account that the final directory may already exist, and adding an ls -ld at the end:
Code:
# Remove .deb.x extension from any directory name
# DIR=/var/mobile/Media/Downloads
DIR=/tmp/xxx
echo Before:
file $DIR/*
for old_sub in $DIR/*.deb.x; do
if [ -d "$old_sub" ]; then
new_sub=$(echo "$old_sub" | sed "s/\.deb\.x$//")
if [ -d "$new_sub" ]; then
echo "$new_sub" already exists
# take action, such as: rmdir "$new_sub"
# take action, such as: rm -r "$new_sub"
# take action, such as: exit
fi
mv "$old_sub" "$new_sub"
fi
done
echo After:
file $DIR/*
ls -ld $DIR/*
Hi,
I have files that are named front1.txt to front999.txt. They are all in the same directory. To change "front" to "back", I am doing something like this.
for file in *.txt; do
new=`echo $file | sed 's/^**/back/g'`
mv $file $new
done
My problem is what if files are named... (6 Replies)
I have a csv file in which there are numbers like
078976/9XXX
098754/8XXX
I want to replace the XXX with null. I want to know the command/code to do this.
I know how to replace the whole word/number. But don't know how to replace a part of it.
Thanks in advance,
Mihir (3 Replies)
I have the part of script:
if ; then
make_command="make -f $temp_file"
print $make_command;
err_file="${sym_objdir}error.log"
$make_command 2>$err_file; cat $err_file;
] && ] && exit 1;
exit 0
fi
... (5 Replies)
Gurus,
You know, I believe you do:-), the comnand uname -r give you the kernel version:
serverA:~# uname -r
2.6.26-1-xen-amd64So, I want to replace this output inside in the line below that is inside the file:
kernel = '/boot/vmlinuz-2.6.26-1-xen-amd64'Suppose, you move this file to ther... (2 Replies)
Hi
I need to Replace a part of string in between one complete string.
For e.g..
in the file the value is as:
jobnm_$code_xyz_001
In script we are having a variable code=$3, where $3=ab
final output should be jobnm_ab_xyz_001.
But it is not working. Your help will be... (1 Reply)
Hello there,
I need some help.
I have a file containing this :
$ cat file
PARM1=(VAL11),PARM2=(VAL21,VAL22,VAL23),PARM3=(VAL31),PARM4=(VAL41,VAL42)
and I need to replace all the ',' by '|' but only those which are between brackets.
Output would be :... (10 Replies)
dear all,
I'm trying to use Awk to eliminate the last two characters from the first column in a file. This two characters are "-1" and I need to eliminate them from each row that I have in the files. The files have two columns and look like:
ID_090-1 2
ID_3787-1 4
ID_0098-1 1
ID_12-1 4
I... (4 Replies)
Hi Gurus,
I need to replace part of string in file, the string format is below: I can use ABCD to find string, then replace values after "=" sign
ABCD_XXX=value
ABCD_YYY=value
after replace
ABCD_XXX=new_value
ABCD_YYY=new_value
my OS is SunOS 5.10 Generic_150400-64 sun4v sparc sun4v
... (9 Replies)