hmm, another long shot in the dark, could it be that, somehow, for this connection, you are running an original Bourne shell, not BASH.
It is interesting.
I know that I have started 'bash', but $SHELL is shown as 'ksh' ?!
The '.myset' has couple declaration, functions and aliases. It is ran as 'source..' (>. .myset # with dot on first position) and couple functions related to the prompt (I have disabled the PS1 for all code, presented here to make it easy to see)..; but all that still seems not related to the problem.
Acctualy, I have already lost connection to the session with that problem and, sure, new one does not have the problem.
drl
Quote:
I suggest you re-run your original script with set -x ... cheers, drl
I could not repeat what I have done before and, even, could not tell what I have done when the problem appeared.
In that day I have worked on part of pretty big script; where I have prepare couple new functions and made some changes in other parts...; and now it works as it should be, and the problem is not showed up...
Quote:
Versions of expr that I have used do not understand the "++" operator.
It is right, it is not processing the '++', but it is not complaining, so I have not seen that.
Last edited by alex_5161; 11-10-2008 at 12:57 PM..
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
As an aside, the variable SHELL is almost never modified to reflect the current shell.
Here is a script that demonstrates the execution of a number of shells, and how to test for them (at least in Linux, untested in other *nix, although Solaris 10 seems to require ps -p $$):
Producing:
cheers, drl
So, by that checking, the $SHELL is not much representing. It keeps a loging shell. Any other started shell processed as a regular running task and does not update the env-SHELL.
Maybe not completely nice, but could be understood.
(off-top, but I did not ubderstand construction
I see the 'version' is checked on acceptance (ignoring all output), and, after that - I guess, it is used for list of words.
It seems that part works like 'for .. in ...; ...', but it is surprizing for me and does not clear how it is done.
'_eat' - is it something local, as a 'version'?
'=o' - it looks strange, isn't it a typo?
It seems the
whould be enouth to present the version number (as I could guess the 'version' functionality) Am I wrong?
Anyway, I do not see the meaning of this execution:
Maybe you could give some description?! I will appreciate it!)
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi, alex_5161.
Generally, you analysed correctly.
The version and _eat commands are local to the business where I work. They are used to document versions of software that are used by the script.
The version command usually obtains the version of other commands by using "command --version" or "command -version", but also takes into account special cases, such as needed for perl, tcsh, python, etc. The special argument =o causes the operating system name to be printed. The _eat command extracts the appropriate token from the shebang (first line of the script).
These are not standard commands, so you will not see them in any Unix, GNU/Linux, etc. That is why my scripts first test for the existence of version (by checking the exit status), uses it if is present, but otherwise skips the remainder of the complex command. This allows people to copy, paste, and run the scripts even if version is not an available command on their systems.
Feel free to remove that section from your copy of the script as you choose.
Another simple method to see the current shell name is:
Best wishes ... cheers, drl
I have a loop with cases
I am working on Bourne shell
for file in *.${Today}*.csv *.${Today}*.txt\
do
case ${file} in
sun_detail)
do something
;;
sum)
do something
;;
mod)
do something
;;
*)
do something
;; (5 Replies)
Hi
I'm using this script to transcode videos in an Ubuntu 12.04 machine.
#! /bin/bash
MOVDIR="/media/topaz_1/media/transcodes/transcode_mov/"
MOVDESTDIR="/media/topaz_1/media/transcodes/final_mov/"
DONEFILESDIR="/media/topaz_1/media/transcodes/dv_cache/"... (1 Reply)
Hi,
I am trying to run the factorial script but it’s not working.
The code is mentioned below:
------------------------------------------------------------------
/home/gc> cat fact.sh
#!/bin/bash
# using one command line parameter
factorial=1
for (( number = 1; number <= $1 ;... (3 Replies)
I have a strange problem.
I have the following in a cron to find files older than a day.
find /dir1/dir2/ ! -name . -prune -name "s*.txt" -type f -mtime +1 -exec echo {} \; | wc -w
It was working fine for the last few days now it suddenly stopped working. I can clearly see files in the... (5 Replies)
Hi Friends,
I am presently migrating shell scripts writter in KSH to SH.I am stuck at this place and i am not able to find a work around:-
Let the script name is x.sh
Below are some of the codes in it...
export abc=hello
export abc=hi
export abc=how
When i am trying to compile the script ... (6 Replies)
Hi-
Here is the shell script that for some reason is not returning results:
#! /bin/ksh -
avg() {
AVG=0
typeset SUM=0
if
then
echo "You must have at least two numbers"
else
for NUM in "$*"
do
... (2 Replies)
Hi Im running this script, which is supposed to find the max value build some tables and then stop running once all the tables are built. Thing is , it keeps assigning a null value to $h and then $g is null so it keep building tables i.e. testupdateNUL. How can I stop this? Here is what I have:
... (4 Replies)
Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines.
It then prompts for deletion of the file.
If user supplies arguments with the script , then it works on those files... (1 Reply)
i have this code for a simple if loop:
#!/bin/bash
array="1 2 3 4 5"
array2="5 6 7 8 9"
if } -gt ${array} ]; then
echo "${array2} is greater than ${array}!!"
fi
the error is
./script8: line 9: [: too many arguments
./script8: line 9: [: too many arguments
./script8: line 9: [:... (10 Replies)
Everything else seems to be working, but this isn't. Is it the "cat..." that is wrong of the condition? Thanks.
cat tc_result.txt | while read LINE
do
if
then
let "files_run += 1";
echo "inside the if loop"
# save current filetype
case $LINE... (5 Replies)