I'm sure this is an easy one but I can't seem to get it working. Given the following:
for oldName in `ls *.JPG` ;do
newName=<confusion here. how to make sed perform 's/.JPG/_thumb.JPG/g' operation on $oldName>
done
Could someone show me what I'm doing wrong?
Thanks
Ken (1 Reply)
Hi all,
I have a directory have all of the .stat and .dat file :
they are is a pipe separate flat file.
Example:
log-20061202.stat contain 1st line and last line of log-20061202.dat with record count of that day.
Example:
Total record = 240
Tom|02-12-2006|1600 W.Santa... (18 Replies)
Basically I have a shell script and i want to search the computer for a folder and if that folder exists i want to take some action. Not sure exactly how to do this most efficiently.
Not very experienced....any help would be appreciated. (1 Reply)
Hello everybody...
I'm a Unix newbie and i just got this task at work to figure out what's wrong with a daily script my team is using.
The idea behind the script is that it takes the day before in a yyyymmdd format, find files with that date in a specific directory and executes an (irrelavant)... (4 Replies)
Q1>How do i read and write to file in shell script. Here is what i want let's assume the filename as "file1"
Read file1
Check the content of file1 which can be either "0" or "1"
if(content == 0)
{
execute a command
}
flush file1(remove all contents in it)
write "1" in to... (5 Replies)
My problem looks like it should have a simple solution but it seems that after many days of research I cannot find a good solution. What I have is an input file that contains lines of information. What I need is to extract specific information from that file. What I know is that somewhere in the... (2 Replies)
script is:
dirname= "$(date +%b%d)_$(date +%H%M)"
mkdir $dirname
should create a directory named Nov4_
Instead I get the following returned:
root@dchs-pint-001:/=>./test1
./test1: Nov04_0736: not found.
Usage: mkdir Directory ...
root@dchs-pint-001:/=>
TOO easy, but what am I... (2 Replies)
Can someone help me write this shell script?
I am completely new to shell and as a fun task my uncle has challenged me a problem (out of all other people). Basically, all he wants me to do is to create backup file in a folder that is named “disables.”
This is what he said: create a shell script... (0 Replies)
Hello all,
I want to write a shell script to list the contents of a directory and number them and write them to a file.
For example, if I have a directory temp and the contents of the directory are alpha, beta and gamma. I want to write these filenames to a file "test" in a numbered manner.
... (7 Replies)
Hi,
I am totally a newbie to any programming languages and I just started an entry level job in an IT company. One of my recent tasks is to create a script that is able to show the log file of linux service (i.e. ntpd service)
lets say, if I run my script ./test.sh, the output should be... (3 Replies)
Discussion started by: xiaogeji
3 Replies
LEARN ABOUT REDHAT
code
code(n) [incr Tcl] code(n)
NAME
code - capture the namespace context for a code fragment
SYNOPSIS
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 cur-
rent 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 executed 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 cor-
rectly, 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)