Results 11 to 16 of 16
Originally Posted by Cancerous
Any command that will contain spaces needs to have the content wrapped in quotes, otherwise it reads them as seperate commands.
Just change this line so ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-20-2012 #11Just Joined!
- Join Date
- Nov 2012
- Posts
- 18
Anyone of you mind checking my post, and help me with explaination of codes. I do need help, anyone who mind giving me some tutorial.
I'm eager to learn, but youtube is too much on the surface, I believe learning from reading and understanding is beneficial.
Any scripter who dont mind sharing your scripts with well-written comment code ?
I need help myself too.
- 11-20-2012 #12Just Joined!
- Join Date
- May 2012
- Posts
- 43
I'm relatively new to scripting myself, but luckily I'm learning on the job and work with some very helpful people.
A lot of what I've learnt is just through googling "how to do [/I]x job[/I] in bash", also looking at forums like this one, looking at what other people post and then analyzing their solutions helps a lot.
Start off small, and then work your way up. If you've got no previous experience in programming then this will help a lot (I knew Visual Basic before I started learning bash).
Read the man pages for what you want to do. egWrite the scripts yourself! I cannot stress this enough. Copying and pasting someone elses work will not teach you anything. Type it out, run it then mess with it a bit. Change something and see what changes in the script.Code:man echo
- 11-20-2012 #13Just Joined!
- Join Date
- Nov 2012
- Posts
- 9
I got it to display the files in the directory but when I added the 2 lines after echo $x so that i can echo the number of files in the directory it keeps bring up zero's.Code:#! /bin/csh foreach x ( `ls` ) echo $x set mycnt=`grep -l $1 * | wc -l` echo $mycnt end
Last edited by atreyu; 11-20-2012 at 02:43 AM. Reason: added code tags to aid in readability
- 11-20-2012 #14Just Joined!
- Join Date
- May 2012
- Posts
- 43
It works for me.
Are you working in a directory with files in it?
- 11-20-2012 #15Just Joined!
- Join Date
- Nov 2012
- Posts
- 9
yes I am, it has several files inside the directory.
- 11-20-2012 #16Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,657



Reply With Quote
