/bin/ps shell command broken

I'm running 10.6.3 and recently noticed the /bin/ps command is broken.
$ ps -ef
ps: illegal option -- f
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-u]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
How do you log an issue with Apple?

Yes this discussion should be held in the Mac OS X Technologies Unix forum
As a point of information, /bin/ps -ef also gives me an illegal -f option.
HOWEVER, if I become root, it works
sudo /bin/ps -ef
UID PID PPID C STIME TTY TIME CMD
0 1 0 0 19:58.45 ?? 20:07.86 /sbin/launchd
0 10 1 0 0:03.90 ?? 0:21.57 /usr/libexec/kextd
0 11 1 0 0:24.04 ?? 0:43.67 /usr/sbin/DirectoryService
it works nicely.
Update. The above was run from iTerm session. When I started an Applications -> Utilities -> Terminal session, the /bin/ps -ef WORKED!
Very strange. I wonder what environmental conditions are affecting the ps option parsing. I find it very hard to beleive that it is the actual terminal emulator.
Take this discussion over to Mac OS X Technologies -> Unix forum, and let the other interested Unix users have a go at figuring this out.
Message was edited by: BobHarris

Similar Messages

  • Unix Shell Command Monitor broken

    Hi all,
    Few days ago I've noticed that I am not able to create/modify Unix Shell Command monitors (two/three states)
    Screenshot: http://fotki.yandex.ru/users/neverregret/view/609083
    I am domain admin and Operations Manager admin so I have sufficient privileges automatically.
    Could you please advice what is going wrong?
    I'll appreciate any help.
    Thank you

    Has the SCOM server been upgraded or patched prior to this starting or were any MPs removed that are associated to the UNIX/Linux functionality?
    Check and see if the Microsoft.SystemCenter.CrossPlatform.UI.OM.Integration.Authoring.ShellCommandTemplate.dll file exists under the SCOM directory structure.
    You can download the latest UNIX/Linux MPs/agents from here
    http://www.microsoft.com/en-us/download/details.aspx?id=29696 and try updating the Microsoft.Unix.ShellCommand.Library.mpb MPs and see if that helps.
    Regards,
    -Steve

  • Calling Shell commands in C programme

    How would i call shell command using C programme.

    #include <unistd.h>
    #include <sys/types.h>
    #include <stdlib.h>
    #include <sys/types.h>
    #include <wait.h>
    int main(void) {
    pid_t pid;
    pid = fork();
    if (pid == 0) {
    execl("/bin/sh", "sh", "-c", "/bin/ls -l > /tmp/ls", NULL);
    exit(1);
    else if (pid > 0) {
    wait(NULL);
    else {
    return -1;
    return 0;
    }

  • Run shell commands using java program

    Hi guys,
    I am trying to run shell commands like cd /something and ./command with arguments as follows, but getting an exception that ./command not found.Instead of changing directory using "cd" command I am passing directory as an argument in rt,exec().
    String []cmd={"./command","arg1", "arg2", "arg3"};
    File file= new File("/path");
    try{
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmd,null,file);
    proc.waitFor();
    System.out.println(proc.exitValue())
    BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream()));
    catch(Exception e)
    {e.printStackTrace();
    So can anyone please tell me what is wrong with this approach? or is there any better way to do this?
    Thanks,
    Hardik

    warnerja wrote:
    What gives you the idea that the process to execute is called "./command"? If this is in Windows, it is "cmd.exe" for example.It does not have to be cmd.exe in Windows. Any executable or .bat file can be executed as long as one either specifies the full path or the executable is in a directory that is in the PATH.
    On *nix the file has to have the executable bit set and one either specifies the full path or the executable must be in a directory that is in the PATH . If the executable is a script then if there is a hash-bang (#!) at the start of the first line then the rest of the line is taken as the interpreter  to use. For example #!/bin/bash or #!/usr/bin/perl .
    One both window and *nix one can exec() an interpreter directly and then pass the commands into the process stdin. The advantage of doing this is that one can change the environment in one line and it  remains in effect for subsequent line. A simple example of this for bash on Linux is
    import java.io.OutputStreamWriter;
    import java.io.Writer;
    public class ExecInputThroughStdin
        public static void main(String args[]) throws Exception
            final Process process = Runtime.getRuntime().exec("bash");
            new Thread(new PipeInputStreamToOutputStreamRunnable(process.getErrorStream(), System.err)).start();
            new Thread(new PipeInputStreamToOutputStreamRunnable(process.getInputStream(), System.out)).start();
            final Writer stdin = new OutputStreamWriter(process.getOutputStream());
            stdin.write("xemacs&\n");
            stdin.write("cd ~/work\n");
            stdin.write("dir\n");
            stdin.write("ls\n");
            stdin.write("gobbldygook\n"); // Forces output to stderr
            stdin.write("echo $PATH\n");
            stdin.write("pwd\n");
            stdin.write("df -k\n");
            stdin.write("ifconfig\n");
            stdin.write("echo $CWD\n");
            stdin.write("dir\n");
            stdin.write("cd ~/work/jlib\n");
            stdin.write("dir\n");
            stdin.write("cat /etc/bash.bashrc\n");
            stdin.close();
            final int exitVal = process.waitFor();
            System.out.println("Exit value: " + exitVal);
    }One can use the same approach with Windows using cmd.exe but then one must be aware of the syntactic differences between commands running in .bat file and command run from the command line. Reading 'help cmd' s essential here.
    The class PipeInputStreamToOutputStreamRunnable in the above example just copies an InputStream to an OutputStream and I use
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    public class PipeInputStreamToOutputStreamRunnable implements Runnable
        public PipeInputStreamToOutputStreamRunnable(InputStream is, OutputStream os)
            is_ = is;
            os_ = os;
        public void run()
            try
                final byte[] buffer = new byte[1024];
                for (int count = 0; (count = is_.read(buffer)) >= 0;)
                    os_.write(buffer, 0, count);
            } catch (IOException e)
                e.printStackTrace();
        private final InputStream is_;
        private final OutputStream os_;
    }

  • Shell Command To Applescript

    Hello, I'm making an Automator-Applescript app that copies icons from files and folders to other files and folders of one's choosing and it's coming along nicely with one exception-copying pictures. As you know, when you get info on a picture, it's icon appears on the top left of the info window. Some pictures have a generic icon and others have an icon of the picture. So, in order for this app to work properly using a picture, the picture must have an icon of the picture and not the generic icon. I have a shell script that will give a picture the desired icon but I was wondering if I can convert the shell script to an Applescript or if there's an Applescript that will achieve this. According to the Automator app the shell is /bin/bash, the pass input:as arguements, and the script is sips -i "$@" Thanks!
    eMac G4   Mac OS X (10.4.9)  

    Thanks for the reply. I tried the script and received-Warning: i not a valid file - skipping
    Error 4: no file was specified
    Try 'sips --help' for help using this tool.
    Actually, what I'm trying to do is to add this shell command to an Applescript. Here's the Applescript- on run {}
    set theSourceObject to my DetermineLocationOfObject("source")
    set theTargetObject to my DetermineLocationOfObject("target")
    my ApplyCustomIcon(theSourceObject, theTargetObject)
    end run
    to DetermineLocationOfObject(ObjectType)
    display dialog "Is the " & ObjectType & " object going to be a file or a folder?" buttons {"File", "Folder"} default button 2
    if button returned of the result is equal to "File" then
    set theObject to choose file with prompt "Please locate the " & ObjectType & " file."
    else
    set theObject to choose folder with prompt "Please locate the " & ObjectType & " folder."
    end if
    return theObject
    end DetermineLocationOfObject
    to ApplyCustomIcon(SourceObject, TargetObject)
    my HandleInfoWindow("source", SourceObject)
    my HandleInfoWindow("target", TargetObject)
    end ApplyCustomIcon
    to HandleInfoWindow(ObjectType, theObject)
    tell application "Finder"
    activate
    set InfoWindow to name of (open information window of item theObject)
    end tell
    tell application "System Events"
    tell application process "Finder"
    tell window InfoWindow
    keystroke tab
    if ObjectType is equal to "source" then
    keystroke "c" using command down
    else
    keystroke "v" using command down
    end if
    end tell
    end tell
    end tell
    tell application "Finder"
    close window InfoWindow
    end tell
    end HandleInfoWindow
    As you can see this is a good script for copying and pasting icons but when you choose a picture with a generic icon it will copy the generic icon. So, I was hoping to add this shell command to create the desired icon for the picture before the copying and pasting event. Thanks again.
    eMac G4   Mac OS X (10.4.8)  

  • Shell Commands

    I have 100 shots I need to render. I know how to submit the shots to qmaster using a shell command, but my problem is that I can only figure out the syntax to have one job per line. That means that instead of one batch with 100 jobs, I get 100 batches, each with 1 job.
    Can anyone clue me in to how I can do this? Here is the code I use per line -
    /Applications/Apple\ Qmaster.app/Contents/MacOS/Apple\ Qmaster -batchname test -clustername testxsan -command "Shell" -options \<command\>test.pl\ a bunch of options and stuff go here\<\/command\>
    The manual also says something about XML commands, although I could not find the file it was referencing at ~Library/Preferences/com.apple.AppleQmaster.plist.

    Hi Dylan,
    I hope this helps. You're real close. Once you set your batch name and send it the job information for the first job, just include the other jobs that you want in batch.
    You can include the same source file multiple times and reference different settings files to create multiple versions of the same clip. Or you can include multiple clips using the same settings files. Or you can mix and match.
    The thing is you have to specify everything for each job.
    Here's an example of one where you send multiple clips using the same settings file. I've broken it out on separate lines to make it easier to read.
    --tom
    /Applications/Compressor.app/Contents/MacOS/Compressor
    -clustername MyVideoCluster
    -batchname MyBigBatchName
    -jobpath /Users/path/to/source/MyVideoClip01.flv
    -settingpath /Users/path/to/video/settings/SettingFileName.setting
    -destinationpath /Users/path/to/output/MyVideoClip01-DONE.mov
    -jobpath /Users/path/to/source/MyVideoClip02.flv
    -settingpath /Users/path/to/video/settings/SettingFileName.setting
    -destinationpath /Users/path/to/output/MyVideoClip02-DONE.mov
    -jobpath /Users/path/to/source/MyVideoClip03.flv
    -settingpath /Users/path/to/video/settings/SettingFileName.setting
    -destinationpath /Users/path/to/output/MyVideoClip03-DONE.mov

  • Execute Shell command in Panel SDK Mac

    Hi,
    I´d like to execute the following task with a Panel:
    • render the active sequence
    • when finished send the output video file to another application using Apple Script
    The Panel SDK Examples are a great start. So the missing part is, how can I send a shell command that executes an AppleScript?
    In the ExtendScript Toolkit I found a function that looks promising. But executing this script only pops up an alert window saying "failed". Here´s the code:
    var test = UIAutomationSupport.helper.executeConsoleCommand("ls -l");
    alert(test);
    So does Premiere has an equivalent function like system.callSystem() in After Effects?
    Thanks,
    Thomas

    Bruce, thanks for your support!
    For those who are interested what bbb_999 refers to, here is how you can execute a shell command (in the example I use "osascript" to launch an AppleScript file):
    In your html file you simply write these simple lines of code
    <script type="text/javascript">
        function executeShellCommand(){
              var result = window.cep.process.createProcess('/usr/bin/osascript','/Users/myUserName/Desktop/test.scp t');
              alert(result.data+" "+result.err);
    </script>
    The first argument of createProcess() is the path to the shell tool.
    That´s all. Hope this helps others.
    Thomas

  • Execute shell command from within pascal code

    Hello there,
    I am trying to execute a shell command from within my pascal code. I use XCode together with FreePascal. I have tried something like:
    exec ('program', 'options');
    adding the 'Dos' unit to the Uses clause of my program.
    Thus, e.g.,
    exec ('mkdir', '/A')
    to create a directory with the name 'A'.
    However, my attempts so far were unsuccessful. Can anyone help me on this, and perhaps provide a simple example of how to do it right?
    Thank you in advance,
    Shane

    In the mean time, I found the problem myself. I am just posting the solution here for anyone that is interested. My original solution was correct, in that the 'Dos' Unit must be added, and that the right command is 'exec'. There was however a problem with the correct path to the program that I wanted to invoke. In the shell, this program was accessible from anywhere. However, in the 'exec' command, the full path to the program must be given. Since I am not a Unix expert, I don't know the reason for this.
    So, in summary, the solution is:
    Uses Dos;
    begin
    exec ('full path to program', 'program options');
    e.g.: exec ('/bin/sh', '/run.sh') to process the commands in the file /run.sh
    end
    Hope this may be of help to anyone else.
    Shane
    Mac OS X (10.3.9)
    Mac OS X (10.3.9)
    Mac OS X (10.3.9)

  • Custom keybinding for shell command in emacs

    Hello all,
    I am a very frequent LaTeX user, and I often have BibTeX references and pstricks images, so I end up compiling my document several times for every document. To speed up this process, I wrote a short, simple shell script (below)
    #!/bin/sh
    file="$1"
    latex \\nonstopmode\\input $file.tex
    bibtex $file
    latex \\nonstopmode\\input $file.tex
    latex \\nonstopmode\\input $file.tex
    dvips $file.dvi
    ps2pdf $file.ps
    This has been much nicer, since instead of typing all of those things, I simply type "mytex file."
    Being the greedy person that I am, I would now like to compile it from emacs without typing the shell command, kind of like C-c C-f when I am just compiling as usual. I don't have very much experience with custom keybindings in emacs anyway, but I certaintly do not know how to call a particular shell command including the current file name.
    Any tips?
    Last edited by keither (2010-02-15 15:18:42)

    First of all, you will probably save some compilation time by using an "inteligent" script such as latexmk. You should look into it if you have not done so already.
    Second of all, AUCTeX will also suggest the "correct" next step when using C-c C-c. Also, you should consider just adding latexmk or your own script to the C-c C-c cycle. Here are some examples from my .emacs
    (eval-after-load "tex"
    '(progn
    (add-to-list 'TeX-command-list
    (list "View in Acrobat Reader" "acroread %o"
    'TeX-run-command nil t))
    (add-to-list 'TeX-command-list
    (list "Count Words" "texcount -inc %s.tex"
    'TeX-run-command nil t))
    (add-to-list 'TeX-command-list
    '("Synctex" "/home/rasmus/.scripts/synctex-emacs %t %b %n" TeX-run-TeX nil t) t)
    If you want to use a script as the one suggested by yourself you would want to look into the last exampe ("Synctex").
    --Rasmus

  • Shell command redux - any help out there?

    so I thought I had this figured out, but apparently I haven't. I have setup the following as my template for a workflow. The ONLY thing it does is run a shell script that edits a text file. If I can make this work, I'll include it in a workflow that actually processes media
    Here's what I've tested. I've verified that this command works from the terminal
    /usr/bin/pcastaction shell --basedir=/ /Library/PodcastProducer/Workflows/Classroom\ Recording\ with\ webpage\ edit.pwf/Contents/Resources/Tools/test.sh
    So, here's what I've got for my workflow. I'm guessing I just have something misconfigured here, or am missing an important piece, but I'm not seeing what that might be. Hopefully someone can help me figure that out... (If anyone has a workflow with a working shell script piece, I'd LOVE to see it!)
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
    <dict>
    <key>artConditions</key>
    <dict>
    <key>0</key>
    <dict>
    <key>artEqual</key>
    <string>1</string>
    </dict>
    </dict>
    <key>artSpecifications</key>
    <dict>
    <key>0</key>
    <dict>
    <key>artArguments</key>
    <array>
    <string>$$Shared Filesystem$$</string>
    <string>$$Server UUID$$</string>
    </array>
    <key>artPath</key>
    <string>$$Workflow Resource Path$$/Tools/art.rb</string>
    </dict>
    </dict>
    <key>name</key>
    <string>$$Xgrid Job Name$$</string>
    <key>notificationEmail</key>
    <string>$$Administrator Email Address$$</string>
    <key>taskSpecifications</key>
    <dict>
    <key>test_shell</key>
    <dict>
    <key>arguments</key>
    <array>
    <string>/usr/bin/pcastaction</string>
    <string>shell</string>
    <string>--basedir=/</string>
    <string>/Library/PodcastProducer/Workflows/Classroom\ Recording\ with\ webpage\ edit.pwf/Contents/Resources/Tools/test.sh</string>
    </array>
    </dict>
    </dict>
    <key>userRequirements</key>
    <array>
    <string>Title</string>
    <string>Description</string>
    </array>
    </dict>
    </array>
    </plist>

    Greetings Skroll,
    Here is a great video that explains how to setup AirPrint with your all-in-one printer.

  • Shell commands in applescript noob

    Hi all this is my first post in these forums and I come seeking help with a certain script I'm writing for my current college job. The purpose of the script is to install creative cloud from a server and this is as far as I've got. First I can get as far as setting the correct directory in the server by doing:
    do script "cd /Volumes/applications/Mac/'Adobe Creative Cloud'/'Enterprise - enduser'/Build"
    now when I press run the terminal screen pops up just fine with no errors in the right directory. However I've been reading up that to do other commands in the same shell I must do do shell script. When doing this however terminal doesn't do...anything. The reason why I was trying this is because my next command would be initiating the install which is the command:
    "installer -verbose -pkg 'enterprise_Install.pkg' -target /" with adminitrator privilages
    Now my question is how would formulate this within applescript? Thanks.

    do shell script "cd /Volumes/applications/Mac/'Adobe Creative Cloud'/'Enterprise - enduser'/Build ;  installer -verbose -pkg 'enterprise_Install.pkg' -target / with administrator privilages"
    You got the double quote in the wrong place.
    do shell script "cd /Volumes/applications/Mac/'Adobe Creative Cloud'/'Enterprise - enduser'/Build ;  installer -verbose -pkg 'enterprise_Install.pkg' -target / " with administrator privilages
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "sudo ls -l  " & quotedUnixDesktopPath with administrator privileges
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • Incorporate shell commands from forms

    How to incorporate unix shell commands(eg. ls, cp) from forms9i?
    In Windows environment,it is possible by issuing
    host command(eg. HOST('DIR >k.lis') -- it moves the list of files from Oracle9i/forms90 path to a file k.lis).
    The same thing I have to do in a unix environment.

    I think you have the wrong forum. This forum has to do
    with the UIX technology inside of JDeveloper. Your
    question seems to have to do with UNIX or forms. I can't
    tell which.

  • Executing shell commands from Java.

    I want to execute shell commands in Java using the Runtime.exec( String ) method.
    The method works fine under Linux OS, but under Windows '98 the method didn't work at all!
    For example the following call: Runtime.exec( "dir" ) throws an exception showing that the command was not completed. If I replace dir with ls under Linux all is good. What is the problem with the Microsoft Windows '98 ? Is there any solution at my problem ?!
    thx in advance!

    hey JSarmis,
    You can help me... "ls" doesn't work for me on linux.. using Runtime.exec, some commands work, others don't... you may hold the key to what i need? How did u get "ls" to work?

  • Running Shell Commands (not Executable) in Unix from Java

    What are my options to run shell commands from Java?
    My goal is to change my existing shell environment variables to some new ones provided by .anotherProfile.
    Using an executable from Java is not an option because it does not work i.e. ( exec(". /home/.profile") ) brings up errors.
    Someone has suggested that I start a child shell with that profile and work from there, but I'm unfamiliar with that sort of syntax and programming in general.
    Any good help equals duke dollars :)

    Well there are some possibilities. In the original thread you mentioned that you wanted the shell script to be executed to change some enviroment parameters of the shell the JVM is executing in.
    If so, and you are able to rewrite the profile so you can parse it manually. Then you can change some environment setting by writing the JNI wrappers for the getenv and setenv system calls. (Check your man pages)
    That will change the environment. I am just wondering what good it will do for you? What's use of sourcing the profile in a JVM?

  • How to run 'Get-AssignedAccess' or 'Set-AssignedAccess' power shell commands in c# Application

    Hi,
    I have console application using which i am trying to run power shell command  like 'Get-AssignedAccess' or 'Set-AssignedAccess'.
    i am using below code for this it is throwing exception 'Get-AssignedAccess' doesn't exist in cmdlet which is correct because these commands belongs to function category.
    using (PowerShell pwInstance = PowerShell.Create())
                            pwInstance .AddScript("Get-AssignedAccess");
                            var result = pwInstance .Invoke();
    How can we execute this kind of command using c#?
    Thanks,

    Hi prakashlight,
    Thank you for comming back and tell us the result. For more information about how to run PowerShell script in C# language, you can refer to this blogpost here:
    Executing PowerShell scripts from C#
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Mail needs to be sent after submitting XMl publisher report

    HI all, I have developed one xml publisher (BI Publisher) report.The requirement is when user submits this report from concurrent program window from his responsibility.mail needs to send one particular mail id. Could you please give me any idea... T

  • Populating fields to another PDF file

    So I have a pdf that multiple people are using. I want to strip certian info upon submission and copy it to another pdf form. Is there a way to do this?

  • Preloader issues...

    Hey guys! I'm new to this site and to the whole flash/scripting business. I finished a website using flash, and the final touch I need to add is a pre-loader. I used this tutorial to get me started: http://www.lukamaras.com/tutorials/p...preloader.ht

  • Problems getting days since last used for licensed software

    Using SCCM 2007 SP2 R3 We've been required to start removing certain licensed software after 60 days of non-use.  Tried the canned reports, but needed to do a customized one to get all the needed info: SELECT DISTINCT SYS.Netbios_Name0 AS 'NAME', CSY

  • Deriving the size of a message

    Having discovered what may be a flaw (or a misunderstanding on my part) in the mailbox statistics report I'm working on my own derivation of the size of messages in one or more accounts. Using the statisitics report as a comparison I'm not arriving a