09-23-2008
Results of testing the two suggestions presented
This is the results of testing the two suggestions presented so far.
(I hope this is not a double post. I posted this earlier but it never appeared in the forum...)
As long as the exact block is entered into the script, all of the methods below will copy the old file (with the backslash) to the new file.
NONE of them will work when the oldname variable is read from the directory or passed from the "for loop" -- even when oldname is EXACTLY the same as any of the text assigned to oldname variables below.
oldname=junk\\junk.txt
newname=junkjunk.txt
cp $oldname $newname
The the above works WITHOUT quotes OR with
double quotes ONLY, on either or both variables
oldname="junk\junk.txt"
newname=junkjunk.txt
cp ${oldname/\/\\} $newname
oldname="junk\junk.txt"
newname=junkjunk.txt
cp $oldname $newname
In the TWO examples above, oldname MUST be quoted, with single OR double quotes,
AND newname MAY or MAY NOT be quoted with single OR double quotes.
-----------
Does this make any sense to anyone. I can not see how the bash shell could distinguish between a variable created inside the script, from data inside the script AND a variable created inside the script from identical text passed in from outside the script.
The only thing I can think of is that I am reading in the filenames to the variable through a pipe and that starts a sub-process which might fold, spindle or mutilate the variable in some manner that causes this problem.
I am leaving the country for a week in about 36 hours. If I have time I will rework the script to where the file list is imported without using a pipe and see if that changes how the variables react.
If anyone has any other ideas I would appreciate hearing them.
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi I am going to migrate our datawarehouse system from HP Tru 64 Unix to the Red Hat Linux.
Inside the box, it is running around 40 cron jobs; inside each cron job, it is calling other shell script files, and the shell script files may again call other shell script files or ctl files(for... (1 Reply)
Discussion started by: franksubramania
1 Replies
2. Shell Programming and Scripting
Dear other forum members,
I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance.
... (3 Replies)
Discussion started by: ilove2smoke
3 Replies
3. Shell Programming and Scripting
I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? :wall: Please be gentle, I'm fairly new to this... (4 Replies)
Discussion started by: jmalfhs
4 Replies
4. Shell Programming and Scripting
Hi,
I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is
# echo $0
-sh
My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies
5. Shell Programming and Scripting
I am new to Shell Scripting and need some help.
The following batch job has been failing for me due to the .nfsxxx files in use. I need to know how to modify the following script to exclude the .nfsxxx files so this batch job will not fail on me. I have done lots of googling and keep coming back... (2 Replies)
Discussion started by: kimberlyg2007
2 Replies
6. Shell Programming and Scripting
HI,
I am trying to implement a simple shell script program that does not make use of ls or find commands as they are quite expensive on very large sets of files. So, I am trying to generate the file list myself. What I am trying to do is this:
1. Generate a file name using shell script, for... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies
7. Shell Programming and Scripting
#!/bin/bash
#
name=$1
type=$2
number=1
for file in ./**
do
if
then
filenumber=00$number
elif
then
filenumber=0$number
fi
tempname="$name""$filenumber"."$type"
if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies
8. Shell Programming and Scripting
Hi,
Can anyone help me how to convert a .csv file to a .pdf file using shell script
Thanks (2 Replies)
Discussion started by: ssk250
2 Replies
9. Shell Programming and Scripting
Hi,
In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this?
I am using #!/bin/ksh
For eg: sftp user@host <<EOF
cd /path
get *.txt
rename *.txt *.txt.done
... (7 Replies)
Discussion started by: jhilmil
7 Replies
10. Shell Programming and Scripting
Hi,
Very good wishes to all!
Please help to provide the shell script for generating the record counts in filed wise from the .csv file
My question:
Source file:
Field1 Field2 Field3
abc 12f sLm
1234 hjd 12d
Hyd 34
Chn
My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies
LEARN ABOUT DEBIAN
genlib_copy_up_seg
GENLIB_COPY_UP_SEG.3(October 1, 1997) GENLIB_COPY_UP_SEG.3(October 1, 1997)
NAME
GENLIB_COPY_UP_SEG - copy a physical segment from an instance in the current figure
SYNOPSYS
#include <genlib.h>
void GENLIB_COPY_UP_SEG(oldname, insname, newname)
char *oldname, *insname, *newname;
ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in
Paris, France.
Web : http://asim.lip6.fr/recherche/alliance/
E-mail : alliance-users@asim.lip6.fr
PARAMETERS
oldname Name of the segment in the instance
insname Name of the instance in the which the segment is to be searched for
newname Name to be given to the segment in the current figure
DESCRIPTION
COPY_UP_SEG adds a segment in the current layout cell. All the segment's attributes are copied from the first found segment called oldname
in the instance insname. The new segment is given the name newname. The main purpose of this function is to rename a segment, so it can be
used later, when extracting a layout.
ERRORS
"GENLIB_COPY_UP_SEG impossible : missing GENLIB_DEF_PHFIG"
No figure has been yet specified by a call to DEF_PHFIG. So it isn't possible to place a segment inside it. you must call DEF_PHFIG
before any other layout action.
"illegal getphins : instance insname does not exist"
The instance called insname does not currently belong to the figure.
"GENLIB_COPY_UP_SEG impossible : segment segname does not exist"
The segment segname does not exist in the model of the instance insname.
EXAMPLE
#include <genlib.h>
main()
{
/* Create a figure to work on */
GENLIB_DEF_PHFIG("cell");
GENLIB_PLACE("z2l_y", "r1", NOSYM, 23L, 54L);
/* Put a segment */
GENLIB_COPY_UP_SEG("mux0_s", "r1", "out_s");
/* Save that on disk */
GENLIB_SAVE_PHFIG();
}
SEE ALSO
genlib(1), GENLIB_DEF_PHFIG(3), GENLIB_SAVE_PHFIG(3), GENLIB_PHSEG(3), GENLIB_THRU_H(3), GENLIB_THRU_CON_H(3), GENLIB_THRU_V(3), GEN-
LIB_THRU_CON_V(3), GENLIB_WIRE1(3), GENLIB_WIRE2(3), GENLIB_WIRE3(3).
BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory.
We need your feedback to improve documentation and tools.
PROCEDURAL GENERATION LANGUAGE
ASIM/LIP6 GENLIB_COPY_UP_SEG.3(October 1, 1997)