Basic bash programming

Any other programming language that is not covered in the Web Scripting category.

Postby nene on Wed Aug 17, 2005 10:22 pm

sorry for the offtopic but anyway... i have been seing lately that users come to forums and post posts like "cool", "nice" and similar... probably because of the signup form which wont let you trough without 20 posts... i hope the admins really take a look at what users write in the posts because some of them really just write posts that are useless. i dont like mentioning usernames... Smile
nene
Regular
Regular
 
Posts: 128
Joined: Wed Apr 13, 2005 10:24 am
Location: Slovenia

Postby DeeBG on Wed Aug 17, 2005 11:45 pm

I have noticed this as well. I'm new here myself but I try to add some context in my replies. I have faith though that even if such a user would be able to obtain a shell, that they would not be able to hold it very long without offering something back to the community. Show your love for PH, express yourself! (If anyone is worried about "bad english" don't... making mistakes is half the fun!)
DeeBG
Contributer
Contributer
 
Posts: 46
Joined: Wed Aug 10, 2005 3:10 am

Postby dante on Wed Aug 24, 2005 6:21 am

It's only fun if people are posting stuff with content in the first place...

I mean, I'd gladly be posting help for C# and PHP all over the place, but there doesn't seem to be much call for it...or, people are just so good at it in the first place that they don't need to ask...
Image
dante
Newbie
Newbie
 
Posts: 18
Joined: Wed Aug 24, 2005 6:05 am

Postby nene on Wed Aug 24, 2005 8:54 am

im am currently learning for my final exam at secondary school... we are talking about bash programming and i am learning how to program batch... aint life a bitch... Very Happy

anyway, i will be needing some help with C# also so stay tuned dante... Smile
Image
nene
Regular
Regular
 
Posts: 128
Joined: Wed Apr 13, 2005 10:24 am
Location: Slovenia

Postby goose on Tue Sep 27, 2005 7:17 pm

When your using bash, make sure for you map the correct binary.. hehe.. OS systems like freebsd, and Solaris dont come standard with bash normally. They may reside in /usr/local/bin rather than just /bin or in solaris they might be in /osw or other prefix libraries.
goose
Contributer
Contributer
 
Posts: 69
Joined: Tue Sep 27, 2005 7:05 pm
Location: United States

Postby goose on Tue Sep 27, 2005 7:38 pm

You should pay attention to the bashrc on different OS's as well..

For instance:
in Solaris / FreeBSD
PS1 would be your prompt
where
PROMPT
would be your command in Linux

I had alot of issues writing different bashrc files for os..

FreeBSD let me have PROMPT and PS1 but when using the "UP" to go through history PROMPT wasnt rewritten to terminal correctly on PS1. Actuall PROMPT was written after PS1 so assigned it to ""
goose
Contributer
Contributer
 
Posts: 69
Joined: Tue Sep 27, 2005 7:05 pm
Location: United States

Postby mm_freak on Thu Sep 29, 2005 3:12 am

No, a shell-script is not just a sequence of commands. I have written whole programs out of them. =)

Also, if you are a shell-guru, then you will love the Z-Shell (zsh). Merge or apt-get app-shells/zsh (Gentoo) or zsh (Debian/Ubuntu).
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby goose on Sat Oct 01, 2005 1:06 am

Ive written some good tools as well.

Basic distribution tools over ssh that feed/execute scripts, return status indicators, session handling/managing for system fleets etc.. As well as file stripping tools. When I want something done fast, bash, when it needs to be done right PERL, if I get paid C++... lol

http://webjob.sourceforge.net/WebJob/index.shtml
goose
Contributer
Contributer
 
Posts: 69
Joined: Tue Sep 27, 2005 7:05 pm
Location: United States

Shell Programming

Postby ncfisher on Mon Oct 24, 2005 2:44 pm

If you do find that you need a little help, I have been in the UNIX world professionally since 1988 and have been using shell programming in my day to day job for over 14 years.

To clarify for some of the previous posts, the shell is an interpretted language and each line is interpretted one line at a time, so in a way, it is a file that just contains a bunch of commands.

However, from the other point of view, the commands can be rather useful constructs like loops, and conditional statements and quite frequently the shell is used to automate your repetitive tasks.

I have written some shell programs that were relatively large (300+ lines), but I also write very concise code, and have been known to find how to do many useful things in the shell to get the job done.

Most of my shell scripts today involve automation of installations or systems administration, but also text processing.

For large text processing jobs, perl is a great language to learn and it is generally faster than the shell.

The good thing is that the more languages and tools you learn, the more productive you will be. I find that I use a little bit each language, a lot of shell, a little perl, and a little C programming.

Other things I am interesting in learn is tcl/tk, java, perl (learn better), and python, and such.

I consider myself fairly expect level in ksh programming (but more often I programming using most of the standard constructs found in all of them for compatibility)
ncfisher
Newbie
Newbie
 
Posts: 15
Joined: Sat Oct 22, 2005 12:45 pm

Postby bart416 on Mon Oct 24, 2005 7:31 pm

anybody a quite complete list of unix commands?
bart416
Valued Member
Valued Member
 
Posts: 164
Joined: Fri Sep 30, 2005 6:50 pm

list of unix commands

Postby ncfisher on Mon Oct 24, 2005 10:13 pm

You can do this command on a unix system that has man pages installed "man -k "(1)" and that will show you your list of all the user accessible commands by name (as long as catman -w has been run or equivalent).

Another good book is "Universal Command Guide" do a google search on it... there is a web site too.
ncfisher
Newbie
Newbie
 
Posts: 15
Joined: Sat Oct 22, 2005 12:45 pm

Re: Shell Programming

Postby mm_freak on Mon Oct 24, 2005 11:02 pm

ncfisher wrote:The good thing is that the more languages and tools you learn, the more productive you will be. I find that I use a little bit each language, a lot of shell, a little perl, and a little C programming.


My experience is that you don't need to learn many languages. Learn a few good general purpose languages. Very good practice is to learn a compiled language (like C/C++), a scripting language (like TCL, Python or Perl) and shell-scripting with your favorite shell. Learn one from each, you won't need more.

My favorites are C++, TCL and zsh. I'm an experienced C++ coder. Sometimes I use TCL for jobs that are more easily done in TCL than in a shell script. I also love to combine C++ and TCL, such that you can have programs with scripting support. TCL is good at C/C++ integration.
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby bart416 on Tue Oct 25, 2005 7:57 pm

For shell scripting almost everything can be used.
Even PHP can be used to write shell scripts if you are handy.
bart416
Valued Member
Valued Member
 
Posts: 164
Joined: Fri Sep 30, 2005 6:50 pm

Postby mm_freak on Wed Oct 26, 2005 8:02 pm

bart416 wrote:For shell scripting almost everything can be used.
Even PHP can be used to write shell scripts if you are handy.


No, a shell script is a script executed by the shell. A PHP script is a script executed by PHP. You need to correct your terminology. =)
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby bart416 on Thu Oct 27, 2005 6:31 pm

mm_freak wrote:
bart416 wrote:For shell scripting almost everything can be used.
Even PHP can be used to write shell scripts if you are handy.


No, a shell script is a script executed by the shell. A PHP script is a script executed by PHP. You need to correct your terminology. =)

Yeah, and if your smart you can let php tell the shell what to do.
Causing it to have quite some controll over your computer.
bart416
Valued Member
Valued Member
 
Posts: 164
Joined: Fri Sep 30, 2005 6:50 pm

PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron