Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

While running my script, I got the following message (it's not an error strictly speaking, because the execution go ahead after) :

myScript -s test -u test2
pk_copylogs[2]: hist: :: not found

However, do you know why does this message appear ?

share|improve this question

closed as unclear what you're asking by Gilles, slm, jasonwryan, Anthon, Shadur Nov 19 '13 at 9:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Run it with ksh -x myScript -s test -u test2 2>&1 | sed -n l > some-file and look in some-file for what is being done just before the error. –  Stéphane Chazelas Nov 18 '13 at 15:16
    
Also, when asking for help about a script's error, ALWAYS include the relevant lines from the script. –  terdon Nov 18 '13 at 15:52
    
I agree, but thus I don't know what is this error about, I don't know what goes wrong with my script, and which lines are prolematic. –  user1058398 Nov 18 '13 at 15:57
    
Show us the script! –  Gilles Nov 18 '13 at 21:51
    
pk_copylogs looks like another script, but might even be a shell function - correct? –  Henk Langeveld Nov 18 '13 at 23:10

3 Answers 3

up vote 2 down vote accepted

The hist command is a korn shell (ksh93) builtin, and is not available in bash.

Your script(s) appears to be running under bash, not ksh.

ksh$ command -V hist
hist is a shell builtin   

bash$ command -V hist
bash: command: hist: not found

Try the following:

$ ksh myScript -s test -u test2

or:

$ SHELL=ksh ksh myScript -s test -u test2

However, hist is a command that's typically only used in interactive mode, and I would not expect it in a script. It is rarely invoked directly, and more often as one of the following aliases:

$ alias | grep hist
fc=hist
history='hist -l'
r='hist -s'        

Look for any of fc, history, r.

share|improve this answer
1  
It works. Actually, it was the line author : ... which wasn't commented. Thank you. –  user1058398 Nov 19 '13 at 7:31
    
fc used to be the original command history editor. –  Henk Langeveld Nov 19 '13 at 14:52

In your myScript code, there is a call to another external script called pk_copylogs. On the second line of the pk_copylogs, there is an assumption that you have a command called hist accessible from anywhere, i.e., in one of the directories included in your $PATH variable.

The most likely cause of this problem is, in most shells I have worked with which I didn't have to configure my shortcuts, but someone prior to me did, the command hist is aliased to command history for the convenience purposes. But when you launch a shell script, that alias goes out the window. Of course your case might be totally different but without seeing the actual code of these two scripts you referenced, i.e., myScript and pk_copylogs, it is very hard to make any assertions

share|improve this answer

Have a look to the second line of the fc_copylogs script, this is the one that trigger the error message.

Here is one way to reproduce exactly the same message you got:

$ cd /tmp
$ cat > pk_copylogs <<%
#!/bin/ksh
fc $1
%
$ chmod +x /tmp/pk_copylogs
$ PATH=$PATH:/tmp pk_copylogs ::
pk_copylogs[2]: hist: :: not found

Of course, it might not be exactly the same situation in your case but it is certainly very close.

The second line of pk_copylogs might simply contain this line

hist ::

which would produce the very same error message, or anything that would expand to it.

If you have no idea about where to look, you can run this command to locate the faulty script:

find / -name pk_copylogs -print 

and then have a look to its first lines with

head /path/to/pk_copylogs
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.