Search Results

Showing results 1 to 37 of 37
Search took 0.01 seconds.
Search: Posts Made By: k2k ; Forum: Shell Scripting and child forums
Forum: Shell Scripting 26 Days Ago
Replies: 3
Views: 490
Posted By k2k
wow, thanks sknake. those 2 articles give me exactly what i need. = )
Forum: Shell Scripting 28 Days Ago
Replies: 3
Views: 490
Posted By k2k
hi,
basically i am trying to write a quick script to remote copy something as follow.

"" scp user@192.168.1.5:/var/tmp/file.txt /var/tmp/newfile.txt ""

if i do above cmd on the shell, i...
Forum: Shell Scripting Mar 3rd, 2009
Replies: 3
Views: 643
Posted By k2k
thank you, that works perfectly in bash. Now i am trying to translate it into perl. i guess i'll post my another question in the perl page.
Forum: Shell Scripting Mar 2nd, 2009
Replies: 3
Views: 643
Posted By k2k
hi,
i am trying to write a script to add 100 users and with certain things created. however, all the book and tutorials online recommend and only show the way to use passwd user after creating a...
Forum: Shell Scripting Feb 10th, 2009
Replies: 1
Solved: count line
Views: 845
Posted By k2k
hi, basically i need to find out how many lines are in a file. would someone please refer me a quick command?

i don't think wc would work since i need the line number.

thanks
Forum: Shell Scripting Nov 10th, 2008
Replies: 1
Solved: weird output
Views: 602
Posted By k2k
I had a similar script in solaris and it had no problem. I wrote this one in freeBSD and it gave me strange output. Can anyone please tell me why? thanks a lot


#!/bin/sh
#This is a shell script...
Forum: Shell Scripting Jul 18th, 2008
Replies: 3
Solved: mailx & heredoc
Views: 1,749
Posted By k2k
Mike,
thanks again, and it surely works. Would you explain a little bit of what you have done?

cat <<EOF | mailx -s "subject" target@address
is it like, you cat whatever in...
Forum: Shell Scripting Jul 17th, 2008
Replies: 3
Solved: mailx & heredoc
Views: 1,749
Posted By k2k
hi,
can anyone give me a brief example using mailx and heredoc to send an email?


#!/bin/sh
mail -s "subject" target@address >>body
hello all,
this is supposed to be the body of...
Forum: Shell Scripting Jul 11th, 2008
Replies: 2
Views: 1,158
Posted By k2k
Mike,
thanks again for the help. i am more experienced after all these misconceptions.
Forum: Shell Scripting Jul 11th, 2008
Replies: 2
Views: 1,158
Posted By k2k
if [ "$1"="-s" -a -n "$2" ] # if $1 is string "-s" and $2 is not null
then
string="$2" # then string="$2"
else
echo "error"
exit 1
fi
echo $string
Forum: Shell Scripting Jul 10th, 2008
Replies: 5
Views: 1,077
Posted By k2k
just to echo myself... if at the beginnig i change everything separated by space , then
foo a a:b a:b:c will be "a a b a b c"

from there if i do the for loop and case above.. it will eliminate...
Forum: Shell Scripting Jul 9th, 2008
Replies: 5
Views: 1,077
Posted By k2k
if i run the program >foo a a:b a:b:c it should result in a:b:c .. the uniq didn't work in the program.. i already made it line by line..... ==''



#!/bin/sh
result=$1
shift

for next...
Forum: Shell Scripting Jul 9th, 2008
Replies: 5
Views: 1,077
Posted By k2k
so is there a way to eliminate the duplicates?
Forum: Shell Scripting Jul 8th, 2008
Replies: 5
Views: 1,077
Posted By k2k
this is a done version of the previous thread. it concatenate all the arguments if they are not the same... however some case will make it a:a:b:a:b:c i try to change all the : into space and...
Forum: Shell Scripting Jul 8th, 2008
Replies: 2
Views: 1,011
Posted By k2k
I try to simply concat the arguments if they are not the same..... what is wrong with this simple code for concat???



#!/bin/sh
result=$1

shift
while [ "$#" -ne "0" ]
do
Forum: Shell Scripting Jul 1st, 2008
Replies: 10
Solved: check for $1?
Views: 1,874
Posted By k2k
just wanna thank mike for the follow up.... i was banging my head to get to sed to work until i saw the first post (thank to who posted too)... and i looked it up "basename" (i m pretty new to shell...
Forum: Shell Scripting Jun 30th, 2008
Replies: 6
Views: 3,407
Posted By k2k
Question 1 I actually found it the answer true somewhere on a unix tutorial website.... however, i don't get what it meant by the largest pattern; to match with . or * , * is probably the larger...
Forum: Shell Scripting Jun 30th, 2008
Replies: 6
Views: 3,407
Posted By k2k
this is homework and i probably shoulda mention. However, it is all open book open notes and free to discuss with classmates or anybody else. There are totally 42 questions and I am not sure about...
Forum: Shell Scripting Jun 29th, 2008
Replies: 6
Views: 3,407
Posted By k2k
hi, i had a few unix questions that I am not sure about the answers. if anybody can give a try... that would be great.

1. In sed, when you do pattern matching, the largest pattern is always...
Forum: Shell Scripting Jun 29th, 2008
Replies: 10
Solved: check for $1?
Views: 1,874
Posted By k2k
hey all,
just to echo myself.... instead of banging my head for solution of the sed and tr wutever.. it could be done by just :
path=/home/admin/foo
dirname /home/admin/foo

thanks...
Forum: Shell Scripting Jun 28th, 2008
Replies: 10
Solved: check for $1?
Views: 1,874
Posted By k2k
Mike,
wow... you are genius! That is really helpful and I had never thought about using the saving to register.

However, i need the dir part of the $path but the last file. ...
Forum: Shell Scripting Jun 28th, 2008
Replies: 10
Solved: check for $1?
Views: 1,874
Posted By k2k
cut works if I know the exact input path="/home/admin/foo"

but if path is an argument.... then it won't know cut -f what field.

what i need is ...

path="$1"
and if $1 is a...
Forum: Shell Scripting Jun 28th, 2008
Replies: 1
Views: 699
Posted By k2k
The code "named mywhich" below does basically the same thing as the "which" command in sh does. however, if i do >mywhich wrongcmd wrongcmd2 wrongcmd3

it will only returns wrongcmd3 not found...
Forum: Shell Scripting Jun 28th, 2008
Replies: 2
Views: 2,118
Posted By k2k
thanks alot... yes, i was writing my own version of the which. I have one more question and i think i can get it done. I'll post the code in another thread. Thanks for the help again.
Forum: Shell Scripting Jun 28th, 2008
Replies: 10
Solved: check for $1?
Views: 1,874
Posted By k2k
thanks, and it definitely helps. I actually figured that out after a while. I have another question if anyone helps out, it would be so great.

say file=/home/admin/foo
and i want to delete...
Forum: Shell Scripting Jun 27th, 2008
Replies: 10
Solved: check for $1?
Views: 1,874
Posted By k2k
hi,
does anyone know how to check if certain character is contained in the argument?

for example: > foo /home/myname

how should I check if the argument contains a "/" character?

thanks
Forum: Shell Scripting Jun 25th, 2008
Replies: 2
Views: 2,118
Posted By k2k
first of all, what can i do to make my command works like the "ls, cp, mv" ?
I always do vi myScript.sh and then chmod +x myScript.sh and I have to execute it like ./myScript.sh ...
Forum: Shell Scripting Jun 6th, 2008
Replies: 2
Views: 913
Posted By k2k
thanks very much. It definitely answered all I need to know. Thank you.
Forum: Shell Scripting Jun 5th, 2008
Replies: 2
Views: 913
Posted By k2k
hello, I am writing a script to send email to all the users. Can anyone provide the syntax or internet source in reading line from a dir or text document?

if users are under /home like:
...
Forum: Shell Scripting Jun 3rd, 2008
Replies: 2
Views: 2,554
Posted By k2k
can anyone tell me how I can print the first or the last character from a sh file ?

i have done research on regular expression and the grep... i couldn't find any cmd that i can use to achieve...
Forum: Shell Scripting May 30th, 2008
Replies: 4
Views: 2,291
Posted By k2k
actually, I don't quite get what it is actually questioning. I think it is asking how I should print out my current directory???

I had my answer pwd, cd . ,,, can you explain what the question...
Forum: Shell Scripting May 30th, 2008
Replies: 4
Views: 2,291
Posted By k2k
What four ways can you specify the current directory in your PATH? for sh

This is a question that I couldn't get it right. I thought pwd is one of the way but it wasn't.

can anyone help?...
Forum: Shell Scripting May 29th, 2008
Replies: 1
Views: 903
Posted By k2k
I know I can do " sed 's/old/new/g' filename to make the change to standard output.... however, is there a way that it would save the change to the file instead of just showing to the screen? ...
Forum: Shell Scripting May 28th, 2008
Replies: 2
Solved: csh vs sh
Views: 2,293
Posted By k2k
I am currently taking shell scripting online, my professor has emphasized again and again not to use csh. I haven't learn in depth the difference between csh and sh yet. Can anyone explain abit what...
Forum: Shell Scripting May 22nd, 2008
Replies: 1
Views: 905
Posted By k2k
would anyone please tell me how i cp the whole directory to another directory without the originalDir name....

ex: say the original contains multiple directory contains multiple directory.. and...
Forum: Shell Scripting May 21st, 2008
Replies: 3
Views: 1,330
Posted By k2k
i used vi:
%vi shellProgramming

and then i typed the shell script in the vi and saved with :wq

However, when i run the vi file ...... %shellProgramming

my unix says "command not...
Forum: Shell Scripting May 16th, 2008
Replies: 1
Views: 826
Posted By k2k
can anybody please give some quick reference in how to insert characters or line of characters to a file... and how to exit the insert mode in the regular expression.

ex:
ed try.txt
1,$p ...
Showing results 1 to 37 of 37

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC