Sponsored Content
Top Forums Shell Programming and Scripting Problem renaming a file with single quotes Post 302353577 by Scrutinizer on Tuesday 15th of September 2009 04:31:39 PM
Old 09-15-2009
Does this work?
Code:
for fn in \'*\'; do
  mv $fn ${fn//\'/}
done

or

Code:
for fn in \'*\'; do
  eval mv \$fn $fn
done

or

Code:
for fn in \'*\'; do
  eval mv '$fn' $fn
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with single quotes in a string and findbug

I'm having trouble manipulating a string that contains single quotes (') in it. I'm writing a ksh script to parse in a few queries from a config file, such as this: findbug \(\(Project 'in' "Deployment,HDRCI,LHS,LSS,WUCI" '&&' Status 'in' "N" '&&' New_on 'lessthan' "070107" \)\) '&&' \(Class... (9 Replies)
Discussion started by: bob122480
9 Replies

2. Shell Programming and Scripting

Double quotes or single quotes when using ssh?

I'm not very familiar with the ssh command. When I tried to set a variable and then echo its value on a remote machine via ssh, I found a problem. For example, $ ITSME=itsme $ ssh xxx.xxxx.xxx.xxx "ITSME=itsyou; echo $ITSME" itsme $ ssh xxx.xxxx.xxx.xxx 'ITSME=itsyou; echo $ITSME' itsyou $... (3 Replies)
Discussion started by: password636
3 Replies

3. Shell Programming and Scripting

Single quotes and double quotes

Hi guys, I have a sed line in double quotes which works fine, but I want it to be in single quotes here is the sed line sed "/abc_def/s/\'.*\'/\'\${abc_def}\'/" can some one give the equivalent to the above script in single quotes Thanks a ton (5 Replies)
Discussion started by: sol_nov
5 Replies

4. Shell Programming and Scripting

problem with echo inserting single quotes

Consider the following script: #!/bin/bash exclude='Archive PST,SystemState' IFS=$"," rsyncExclusions=$(for exclude in ${exclude}; do echo -n -e --exclude=\"${exclude}\"\ ; done) unset IFS echo rsync $rsyncExclusions test rsync -avh --delete --delete-excluded "$rsyncExclusions"... (7 Replies)
Discussion started by: jelloir
7 Replies

5. UNIX for Dummies Questions & Answers

grep single quotes or double quotes

Unix superusers, I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
Discussion started by: george_vandelet
2 Replies

6. Shell Programming and Scripting

Replace single quote with two single quotes in perl

Hi I want to replace single quote with two single quotes in a perl string. If the string is <It's Simpson's book> It should become <It''s Simpson''s book> (3 Replies)
Discussion started by: DushyantG
3 Replies

7. Shell Programming and Scripting

File renaming problem

Can someone tell me how can i remove the RPCFTP word from RPCFTPfilelist.csv file ? (4 Replies)
Discussion started by: JSKOBS
4 Replies

8. Shell Programming and Scripting

Search replace strings between single quotes in a text file

Hi There... I need to serach and replace a strings in a text file. My file has; books.amazon='Let me read' and the output needed is books.amazon=NONFOUND pls if anybody know this can be done in script sed or awk.. i have a list of different strings to be repced by NONFOUND.... (7 Replies)
Discussion started by: Hiano
7 Replies

9. Shell Programming and Scripting

Having a terrible problem with quotes/single quotes!

Hello. I'm trying to write a bash script that uses GNU screen and have hit a brick wall that has cost me many hours... (I'm sure it has something to do with quoting/globbing, which is why I post it here) I can make a script that does the following just fine: test.sh: #!/bin/bash # make... (2 Replies)
Discussion started by: jondecker76
2 Replies

10. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies
code(n) 							    [incr Tcl]								   code(n)

__________________________________________________________________________________________________________________________________________________

NAME
code - capture the namespace context for a code fragment SYNOPSIS
itcl::code ?-namespace name? command ?arg arg ...? _________________________________________________________________ DESCRIPTION
Creates a scoped value for the specified command and its associated arg arguments. A scoped value is a list with three elements: the "@scope" keyword, a namespace context, and a value string. For example, the command namespace foo { code puts "Hello World!" } produces the scoped value: @scope ::foo {puts {Hello World!}} Note that the code command captures the current namespace context. If the -namespace flag is specified, then the current context is ignored, and the name string is used as the namespace context. Extensions like Tk execute ordinary code fragments in the global namespace. A scoped value captures a code fragment together with its namespace context in a way that allows it to be executed properly later. It is needed, for example, to wrap up code fragments when a Tk widget is used within a namespace: namespace foo { private proc report {mesg} { puts "click: $mesg" } button .b1 -text "Push Me" -command [code report "Hello World!"] pack .b1 } The code fragment associated with button .b1 only makes sense in the context of namespace "foo". Furthermore, the "report" procedure is private, and can only be accessed within that namespace. The code command wraps up the code fragment in a way that allows it to be exe- cuted properly when the button is pressed. Also, note that the code command preserves the integrity of arguments on the command line. This makes it a natural replacement for the list command, which is often used to format Tcl code fragments. In other words, instead of using the list command like this: after 1000 [list puts "Hello $name!"] use the code command like this: after 1000 [code puts "Hello $name!"] This not only formats the command correctly, but also captures its namespace context. Scoped commands can be invoked like ordinary code fragments, with or without the eval command. For example, the following statements work properly: set cmd {@scope ::foo .b1} $cmd configure -background red set opts {-bg blue -fg white} eval $cmd configure $opts Note that scoped commands by-pass the usual protection mechanisms; the command: @scope ::foo {report {Hello World!}} can be used to access the "foo::report" proc from any namespace context, even though it is private. KEYWORDS
scope, callback, namespace, public, protected, private itcl 3.0 code(n)
All times are GMT -4. The time now is 05:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy