Quote:
Originally Posted by
Arnaudh78
Thank for your reply, I use #!/bin/bash, So I work in Bash ? I'm beginner, I'm open at all.what do you recommend?
This depends on how you invoke your script.
If the script as executable rights, and you invoke it by typing the script name, the
#! line defines, which language processor will be used to run your script. In your case, it is the bash executable stored in the /bin directory.
Alternatively, you can invoke the language processor to be used explicitly from the command line. For instance, if I write
bash myfile, the file
myfile should better be a bash script (and not zsh or ksh or awk....), as it will be executed under bash. The same applies to other languages - zsh, perl, ruby, ....
Now as for the recommendation. It is difficult to give a recommendation without starting a language war, because most programmers seem to be very picky when it comes to choosing one language over another, and everyone has his favorite pet, so note that I give here only my personal opinion, and others might advice you differently.
As for shell programming, after having had long experience with bash and a little bit experience with ksh, csh and tcsh, I turned to zsh, because I found that quite a few things are simpler to do in zsh than in the other languages. I yet have to see something which is easier to do in bash than in zsh (there
must be something). The main drawback of zsh is that fewer people use it, so if you get stuck, you might have to search longer for someone to help. However, I got every zsh question answered by someone so far.
As second language, I tend to use Ruby (after having collected experience with awk, Perl, Python and Tcl), because I found it more expressive than the others and much easier to learn.
Of course one thing to consider it, where your script will run, and how much control you have on the software at the target machine. If I know that there is no zsh installed on the target machine, and I don't even have an account there, it would not be wise to deliver a zsh script. Having said this, even when using bash, you should make sure that you either develop your scripts with the same bash version than the one available on the target host, or write your scripts in a way that they will likely run under each version. This might turn out to be difficult, in particular for someone who doesn't have much experience yet.
If you run your programs only on your own machine, it is up to you what tools you choose.