|
|
|
|
|
|
| Author |
Message |
Janis Papanagnou *nix forums Guru
Joined: 24 Feb 2005
Posts: 450
|
Posted: Sat Apr 01, 2006 5:36 pm Post subject:
Re: some problem about unix cmd "export"
|
|
|
geniusbear1016@gmail.com wrote:
| Quote: | Thanks for your relpy, Janis.
I know the way that use dot.
But I wnna understand the cmd export clearly.
|
From the ksh88 man page...
:
: export [ name[ =value ] ] . . .
:
: The given names are marked for automatic export to the environment
: of subsequently-executed commands.
| Quote: | Can you give me an easy example that use export in shell correctly?
|
export var="string value"
export var2=$var
var3=$var
export var3
Janis
|
|
| Back to top |
|
 |
lancerset@gmail.com *nix forums beginner
Joined: 21 Mar 2006
Posts: 29
|
Posted: Sat Apr 01, 2006 11:07 pm Post subject:
Re: cuts fields by date sed, awk ?
|
|
|
Hello Again,
Do you know why when date is variablized it doesnt get
interpolated..Although the
date written as /Apr 01/ works just fine...
DATE=`date +%b\ %d`
perl -00ne 'print if /$DATE/' Log01.log > "$DATE".Log.log
I've tried your method as well with $ENV, and nothing is getting
written to the log |
|
| Back to top |
|
 |
Chris F.A. Johnson *nix forums Guru
Joined: 20 Feb 2005
Posts: 2268
|
Posted: Sat Apr 01, 2006 11:19 pm Post subject:
Re: cuts fields by date sed, awk ?
|
|
|
On 2006-04-01, onlineviewer wrote:
| Quote: | Hello Again,
Do you know why when date is variablized it doesnt get
interpolated..Although the
date written as /Apr 01/ works just fine...
DATE=`date +%b\ %d`
perl -00ne 'print if /$DATE/' Log01.log > "$DATE".Log.log
|
Variables are not expanded when used inside single quotes. Use
double quotes instead:
perl -00ne "print if /$DATE/" Log01.log > "$DATE".Log.log
| Quote: | I've tried your method
|
Whose method? Please read <http://cfaj.freeshell.org/google>.
| Quote: | as well with $ENV, and nothing is getting
written to the log
|
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence |
|
| Back to top |
|
 |
xicheng@gmail.com *nix forums Guru
Joined: 10 Nov 2005
Posts: 468
|
Posted: Sun Apr 02, 2006 12:47 am Post subject:
Re: cuts fields by date sed, awk ?
|
|
|
onlineviewer wrote:
| Quote: | Hello Again,
Do you know why when date is variablized it doesnt get
interpolated..Although the
date written as /Apr 01/ works just fine...
DATE=`date +%b\ %d`
perl -00ne 'print if /$DATE/' Log01.log > "$DATE".Log.log
I've tried your method as well with $ENV, and nothing is getting
written to the log
|
because you use the hash %ENV of perl which needs your variable set in
your program's enviroment. so you can either add
export DATE
before you run perl command, or you can just prefix your definition to
the perl command, like:
VAR="something" perl -e '#perl cmd'
this influences only the enviromental parameters of your current
program "perl" instead of your shell enviroment..
so you can do:
either:
export DATE=`date +%b\ %d`
perl -00ne 'print if /$ENV{DATE}/' Log01.log > "$DATE".Log.log
or in one line:
DATE=`date +%b\ %d` perl -00ne 'print if /$ENV{DATE}/' Log01.log >
"${DATE}.Log.log"
Xicheng |
|
| Back to top |
|
 |
Janis Papanagnou *nix forums Guru
Joined: 24 Feb 2005
Posts: 450
|
Posted: Sun Apr 02, 2006 4:15 am Post subject:
Re: fill a (cd|dvd) up efficently
|
|
|
TOC wrote:
| Quote: | back in the old (dos) days, I used to have a utility which would, given a
group of files to backup, would efficiently fill up a floppy disk.
I would like to put together something similar in bash for burning blank
single sided data DVDs.
so basically say I have a couple hundred files ranging from 10MB to 1000MB.
I would like to do something like the following:
./_find_files_that_will_fit_efficiantly_on_a_dvd.sh .
#the following files occupy 4.61 GB of disk space
#+and should fit on a single sided data dvd.
/home/myname/data/file234234.dat
/home/myname/data/file2342345344.dat
/home/myname/data/file234345234.dat
/home/myname/data/file2233454534234.dat
/home/myname/data/file2342534234.dat
/home/myname/data/file2342543234.dat
hope that makes sense... I will monitor this thread closely... so if I am
unclear, feel free to ask me questions.
thanks in advance.
|
For the background look for "Greedy Algorithm"
"Martello and Toth (1990) proposed a greedy version of the algorithm
to solve the knapsack problem. Their version sorts the essentials in
decreasing order and then proceeds to insert them into the sack,
starting from the first element (the greatest) until there is no
longer space in the sack for more. If k is the maximum possible number
of essentials that can fit into the sack, the greedy algorithm is
guaranteed to insert at least k/2 of them." [quoted from Wikipedia]
Which is the base of the solutions suggested upthread.
See also: http://en.wikipedia.org/wiki/Greedy_algorithm
Janis |
|
| Back to top |
|
 |
Michael Paoli *nix forums Guru Wannabe
Joined: 10 Oct 2005
Posts: 107
|
Posted: Sun Apr 02, 2006 8:02 am Post subject:
Re: some problem about unix cmd "export"
|
|
|
geniusbear1016@gmail.com wrote:
| Quote: | I can use the cmd export well.
ex:export abc=100
and i can use set or export to see the variable abc
abc=100
but when i write it in a shell.
ex: shell tt, chmod 777 tt
content of tt: export abc=100
execute: tt
and i can't see the variable abc when i type set or export cmd.
Can anyone tell me why ?
or give me some ref..
|
Pretty much the same question was addressed rather recently.
See this thread:
http://groups.google.com/group/comp.unix.admin/browse_thread/thread/d47258249c90484e/063fd19260bf2ebf?&hl=en
Or this article in that thread:
Message-ID: <1142520175.663132.94860@z34g2000cwc.googlegroups.com>
Also, chmod 777 is generally a very bad idea security-wise. |
|
| Back to top |
|
 |
Mitch Johnston *nix forums beginner
Joined: 05 Feb 2006
Posts: 10
|
Posted: Sun Apr 02, 2006 8:36 am Post subject:
Re: Backspace and Delete key mappings
|
|
|
On Fri, 31 Mar 2006 15:39:01 -0500, <dmarkh@cfl.rr.com> wrote:
| Quote: | I have read much on the subject of these 2 keys. Yet I have not been
able to do what I need to do. I need the backspace key to generate
0x08(^H) and the delete key to generate 0x7f(del) during the execution
of a single application. On all my linux boxes the backspace generates
0x7f(^?) and the del key generates ^[[3~. I need to be able to change
that before I execute my program then change it back when my
application is done. stty does NOT do the job nor does my application
use termdef. I have found a little expect script that does do what I
need. I execute "script program" and the keys come out like I want.
#!/usr/bin/expect
eval spawn -noecho $argv
interact {
\177 {send "\010"}
"\033\[3~" {send "\177"}
However I am really looking for basic Linux commands that can be
executed from the bash shell that will do the same thing or a method of
making my application do it from within its self.
Thanks and regards
Mark
|
You can use 'stty' to set it:
stty erase {key}
..\\itch - Pain - finally, something we can depend on.
--
..\\itch Johnston - Bearded Dragon |
|
| Back to top |
|
 |
dmarkh@cfl.rr.com *nix forums beginner
Joined: 02 Apr 2006
Posts: 1
|
Posted: Sun Apr 02, 2006 8:43 am Post subject:
Re: Backspace and Delete key mappings
|
|
|
|
As I noted in the post, stty does not do it. |
|
| Back to top |
|
 |
Casper H.S. Dik *nix forums Guru
Joined: 20 Feb 2005
Posts: 1634
|
Posted: Sun Apr 02, 2006 11:55 am Post subject:
Re: Backspace and Delete key mappings
|
|
|
"Mitch Johnston" <mxj_97@yahoo.com> writes:
| Quote: | You can use 'stty' to set it:
stty erase {key}
|
An unfortunate shortcoming of the way UNIX handles ttys is that
you can only have one "erase" key; I'd prefer both backspace and delete
to erase; while most shells do this, other programs do not.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth. |
|
| Back to top |
|
 |
Harry *nix forums addict
Joined: 17 Mar 2005
Posts: 58
|
|
| Back to top |
|
 |
lancerset@gmail.com *nix forums beginner
Joined: 21 Mar 2006
Posts: 29
|
Posted: Mon Apr 03, 2006 3:15 am Post subject:
Re: cuts fields by date sed, awk ?
|
|
|
|
thats great,,thanks a bunch |
|
| Back to top |
|
 |
BusyBoy *nix forums beginner
Joined: 27 May 2005
Posts: 44
|
Posted: Thu Apr 06, 2006 7:44 am Post subject:
Re: 分享還不錯用的免費電子書閱讀器"eREAD"
|
|
|
really?
Moody
PTML |
|
| Back to top |
|
 |
TeraNews *nix forums beginner
Joined: 08 Apr 2006
Posts: 1
|
Posted: Sat Apr 08, 2006 12:20 am Post subject:
Re: rsh without password, New problem
|
|
|
"sunny" <sunny.ijk@gmail.com> wrote in message
news:1144432795.497672.227460@j33g2000cwa.googlegroups.com...
| Quote: |
Hi all,
Thanks all for having this group.
I am New to the world of Linux and networking. I request you
to help me in solving my problem.
I have 2 linux installed machines. Machine A and Machine B.
Basically i need to execute "rsh B -l root mkdir /root/sanny" command
from machine A.
And i need to use rsh only.
Senario 1:: I am able to connect succesfully from Machine A to Machine
B with { #rsh A } which asks for password. But when i issues a command
along with it it gives me an error. i.e when { #rsh A -l root date} i
get error as "poll:protocol failure in circuit setup".
Senario 2:: I am not able to login without command execution. i.e i am
not able to connect to the Machine A from Machine B with {#rsh B}
itself. It says "A.domain.com:Connect refused"
The below the following steps that i followed on these 2 machines.
1) Both machines have ALL : ALL in /etc/hosts.allow file and nothing in
/etc/hosts.deny file.
2) Both machines have rsh , rlogin, rexec enabled i.e in the file
/etc/xinetd.d/(rsh) (rlogin) (rexec) the disable is turned on from
disable=yes to disable=no.
3)Both the machines have ~/.rhosts file conents as "+ +" . (i also
tried with host.domain.com names).
4)Both the machines had /etc/hosts.equiv files with B.domain.com and
A.domain.com names respectively in Machine A and in Machine B
5)Both the machines were restarted after saving the changes.
Thanks in advance
Sanny
|
OK try this...Coming from he Solaris world and NIS, I did exactly as you
did.
What I found is that although putting a simple "+" in the .rhosts file
should work,
it didn't for me. What I did is experiment with the /etc/hosts.equiv file
and put a "+" in
there as well.
Then I explicity put the host name in there. Voila...It worked.
So, not really caring about security, I created a netgroup rh50 (,,) and
stuck that
in the hosts.equiv as such +@rh50
That worked. Play around a bit and see.
Good Luck |
|
| Back to top |
|
 |
miles.purdy@shaw.ca *nix forums beginner
Joined: 15 Mar 2006
Posts: 39
|
Posted: Mon Apr 10, 2006 5:51 pm Post subject:
Re: rsh without password, New problem
|
|
|
Did you get this to work yet?
Under AIX, which sounds very similar:
1. configure inetd
2. configure TCP Wrapper:
root@unxd1:/home/aclient>cat /etc/hosts.allow
#
rshd: ALL@10.113.209.0/255.255.255.0
I really wouldn't use ALL: ALL in hosts.allow unless that is what you
want, but then why use TCP Wrapper?
root@unxd1:/home/aclient>cat /etc/hosts.deny
ftpd: ALL: (/usr/sbin/safe_finger -l @%h | /usr/bin/mail -s %d-%c
root) &
rexecd: ALL
rshd: ALL
rlogind: ALL
telnetd: ALL
In /.rhosts, put the name that can be looked up, this is important.
Make sure that A and B are in /etc/hosts or your DNS server. In
~/.rhosts just put B (on A) and A on B. Like this:
A +
B +
Again verify that your name resolution works.
Restart inetd.
I don't use NIS and /etc/hosts.equiv. |
|
| Back to top |
|
 |
Uri Guttman *nix forums Guru Wannabe
Joined: 22 Jan 2006
Posts: 253
|
Posted: Thu May 04, 2006 6:42 pm Post subject:
Re: Script that gives instance count unique patterns in a sorted file
|
|
|
| Quote: | "GUA" == Generic Usenet Account <usenet@sta.samsung.com> writes:
|
that is some of the worst perl code i have ever seen. it won't even
compile. come back when your code compiles cleanly.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Tue Dec 02, 2008 6:36 am | All times are GMT
|
|
Myspace Backgrounds | Free Advertising | Mortgages | Loans | Debt Consolidation
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|