Aprz Shell

Well, ever since I switched to Linux, I've been interested in os development. An important part of the operating system is the shell. So recently, I decided to write my own shell, which I hope I can make featureful and robust enough to use in place of GNU Bash.
I am not so sure if this is the appropriate forum because it could work in Community Contribution too in my opinion and this isn't a programming question really, just sharing the source code, but you guys can criticize and suggest things.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char *args[80];
char input[80];
int errno;
int i;
int main(void) {
while(strcmp(input, "exit")) {
i = 1;
do {
printf("Aprz-0.3$ ");
gets(input);
} while(input[0] == '\0');
args[0] = strtok(input, " ");
while((args[i] = strtok(NULL, " ")) != NULL && ++i);
if(!strcmp(args[0], "cd")) {
chdir(args[1]);
continue;
if(fork() == 0 && strcmp(input, "exit")) {
errno = execvp(args[0], args);
if(errno < 0) printf("%s: command not found!\n", args[0]);
exit(1);
} else wait(NULL);
return 0;
This is version 0.3 of it. I've been sharing this with other people on two private forums, but they haven't been so enthusiastic as I am about it so I figured putting it in a public spot such as this full of technical experts and enthusiast will get me better input.
I am terribly sorry I haven't commented it either, haha! I meant to do that starting from day 1, but I slacked off on that instead since it's so small.
Oh, feel free to distribute, modify, and all that nonsense. Don't forget to give me credit though. Also please, if you're taking an operating system class and you're suppose to make a shell, don't cheat yourself and the class by using this.
I am mostly making this just for kicks, but I am also giving it a lot of attention right now.
Anyhow, criticism, questions, and suggestion will be greatly appreciated.
Last edited by Aprz (2009-04-15 02:19:57)

Heh, not so sure if it is a good template, but I guess all software, good or bad, should be free.
Edit: Current progress of Aprz-0.4. I actually took the seconds to annotate the code. I also added put putenv() so I wouldn't have to type /sbin/reboot and stuff like that. So you may want to edit it.
-code removed to keep post size small-
I hope by annotation the source code and putting envp() at line 48. This will make it easier to use and edit. I actually don't know how to pipe yet, but I am going to look at it soon. I hear it is easy.
Edit: Removed the code above with some very minor errors and posting it here. XD
/* Aprz Shell - an interactive prompt that execute commands
* Feel free to modify this however you wish, change it, redistribute it,
* blah blah blah, just as long as you give me credit for starting
* this mini project off. School childern shall not turn this in as
* their homework assignment by the way (even though I doubt this is
* even considered near a C+ right. What do you guys give this? A D-
* right now since there is no tab completion? :(
* If you notice any mistake in documentation in the source code, any
* minor (or major) programming errors, have a suggestion, or anything
* like that, feel free to notify me.
* Name is Andrew Przepioski.
* E-mail: [email protected]
* ========================================================================
* !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
* =========================================================================
* Did I get your attention now? Yes at line 48, you need to edit it
* to fit you... I am just going to leave it as the default in
* in the source code and it is up to you to edit it! It is your
* PATH.
* THANKS
* Ventrue - Pointed out a few typos and grammatical errors.
* Milo - Pointed out that PATH doesnt need ':' at the end of it.
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* args - my imitation of argv
* input - the user's input
* argc - my imitation of argc
* ret - return*/
char *args[128];
char input[128];
int argc;
int ret;
/* Isn't the name and what it is doing obvious enough?! Gosh... */
void sighandler(int signo) {
write(1, "\r", 1);
int main(void) {
/* Set PATH or else it would just be "/bin:/usr/bin:". */
putenv("PATH=/bin:/usr/bin");
/* If you're using firefox and have fancy things like flash,
* you'll want this. */
/*putenv("MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins:/opt/mozilla/lib/plugins");*/
/* Disable ctrl-c. This also disabled ctrl-d and other guys,
* I'll work on that later since I am feeling lazy. */
signal(SIGINT, SIG_IGN);
signal(SIGINT, sighandler);
/* Nice going Captain Obvious.. ;) Yes, this is the loop
* that keeps Aprz Shell alive until the user enters exit. */
while(strcmp(input, "exit")) {
/* argc 0 would be the program name. */
argc = 1;
/* Print out a lovely prompt and let the user type
* in junk. */
do {
printf("Aprz-0.4$ ");
fgets(input, 128, stdin);
} while(input[0] == '\0');
/* Fix a minor detail with using fgets(). */
input[strlen(input) - 1] = '\0';
/* Parse/tokenize the user's input using space as
* a delimiter. */
args[0] = strtok(input, " ");
while((args[argc] = strtok(NULL, " ")) != NULL && ++argc);
/* Magically change directories. */
if(!strcmp(args[0], "cd")) {
chdir(args[1]);
continue;
/* Initiate process and execute the user input. */
if(!fork()) {
ret = execvp(args[0], args);
if(ret < 0 && strcmp(input, "exit")) printf("%s: command not found!\n", args[0]);
exit(0);
} else wait(NULL);
return 0;
Edit: Hm... I think I'll need to do something like #define to set PATH. Seems like a pain to scroll down to edit that and edit me saying where it is at ^ cause it's not in the right spot anymore.
Last edited by Aprz (2009-04-17 22:47:36)

Similar Messages

  • 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

  • How to configure a shell and tube heat exchanger with Lab VIew to get data

    HiI
    In our undergraduate chemical engineering labboratory we want to configure our shell and tube heat exchanger  with a DAq and Lab VIEW to get information about the temperaure (of the cold fluid stream being heated), the pressure (of the steam on the shell side of the heat exchanger) and the flowrate (of the water being heated).
    Can anyone suggest thermocouples, pressure transducers and flowmeters to fit between the heat exchanger and the DAq?
    P.S. the heat exchanger is already fitted with thermometers, a pressure gauge and a rotameter but we don't know how to connect these hardware to the DAq
    Solved!
    Go to Solution.

    It sounds like you have enough information to pick out appropriate sensors, you just need to do the research. I would start looking through the Omega catalog, or give them a call - they're usually helpful. I can't take the time to spec out parts for you - that would be a lot of time spent on someone else's project. Most pressure sensors put out either a 4-20mA or 0-5V signal, either of which you can read through an analog input on a DAQ; measuring a 4-20mA signal requires a resistor to convert to voltage. Most of the NI DAQ boards can read a thermocouple on an analog input, but make sure that your hardware does support reading thermocouples. For accurate readings, use a device that has built-in cold junction compensation - for example, the SCB-68 connector block - and for the most accurate readings, get a board specifically designed for temperature measurement.
    For the flow measurement, a standard, simple solution is an orifice plate. You put a differential pressure transducer across it, look up the appropriate equations, and use them to calculate the flow rate given the density of the fluid (which you'll be able to calculate from the pressure and temperature, since steam tables are widely available). There are other differential pressure devices available as well - at a previous job we used a V-Cone from McCrometer. If you call them they'll spec one for you - but get an approximate cost first to make sure it's within your budget.

  • Trying to create a shell script to cut/paste files in finder. Help needed.

    I'm trying to create an automator shell script to cut/paste. It'll function exactly like copy/paste. i.e. I'll just copy file/files with command+c like always, but then I'll create an automator which uses the "mv" terminal app to move the files which works exactly like cut paste.
    I need some help since I don't know the syntax for creating shell scripts.
    What I did so far is to do it in automator with Apple Script which goes like the following:
    on run {input, parameters}
    tell application "Finder"
    set theWindow to window 1
    set thePath to quoted form of (POSIX path of (target of theWindow as string))
    end tell
    tell application "Terminal"
    do script with command "mv \"" & input & "\"" & thePath in window 1
    end tell
    return input
    end run
    This gets the copied file path from clipboard before, as input, and then recognizes the active finder window as thePath so then executes the mv command for the input file to the thePath window.
    It doesn't work as expected since it connects both file/window paths into a single path instead of leaving a space between them so the mv command can't recognize two separate paths.
    What's the correct syntax for that line
    do script with command "mv \"" & input & "\"" & thePath in window 1
    to leave a space between input and thePath under the mv command?
    Also this requires the terminal app to be open in the background.
    After I get this to work I want to do the exact same thing using shell script within automator, so I won't need Terminal to be open all the time.
    And the next step will be to cut/paste multiple files/folders but that should be easy to do once I get the hang of it.

    Try using:
    on run {input, parameters}
    tell application "Finder"
    set theWindow to window 1
    set thePath to quoted form of (POSIX path of (target of theWindow as string))
    end tell
    do shell script "mv \"" & input & "\" " & thePath
    return input
    end run
    (45977)

  • [SOLVED] Unable to load Gnome Shell 3.0

    Hi all,
    Did a search and didnt find anything on this. I really like gnome3 while testing it on an ubuntu machine and I think with time it would be great. So I said to myself I wonder how great it would be with a nice clean arch install.
    I created a fresh install and followed the directions here.....
    https://wiki.archlinux.org/index.php/GNOME_3
    I keep getting package not found errors in pacman though.
    I uncommented the testing repo as instructed above
    #testing uncommented
    [testing]
    Include = /etc/pacman.d/mirrorlist
    no dice
    pacman -Syu testing/gnome gives me a package not found error.
    I thought ok maybe my mirriorlist is too old so I updated my mirrors to the latest....no dice. testing/gnome not found
    So I said ok maybe I can just upgrade. I went through the normal gnome 2 install procedure and have a working gnome wm environment. So as instructed above I tried to do the upgrade.
    pacman -S gnome-shell.....no dice. gnome-shell not found.
    pacman -Syu always shows testing repo update first so I know thats correct.
    The same thing happened to me when kde 4.6 came out. I was unable to load it from the repository. 4.5 kept loading no matter what I did.
    This is only my second question on these forums and I have been using arch for 2 years so be gentle ;-) I always try to rtfm first. Then forum search.
    I would just try it out in suse but suse is just sooo fat. Folks in the forums there tend to slam a guy for asking an honest question quite a lot too. ( not me but while trying to load broadcom-wl I had to do several searches and wow....) Plus I hate thier package mangement.
    Thanks in advance for any advice offered,
    Shakz
    Last edited by Shakz (2011-04-14 02:34:58)

    Inxsible wrote:
    on topic though : have you enabled testing and community-testing both?
    If you are on 64 bit and are using multilib, then make sure you enable multilib-testing as well. Also make sure that the order of the repos is very important. testing must be before core and extra.
    Also what mirrors have you used. Try the kernel.org and see if it helps.
    Ah ok thanks for the response. I am using 64bit (sry for not mentioning that) Ill try to enable multilib-testing when I get home.
    For repos I have all US repos uncommented as I use powerpill. I only comment out a few that always give connectivity errors.
    Testing is uncommented above core and extra.
    Appreciate it Inxsible!

  • How to call shell script from a pl/sql procedure

    Hi all,
    I am little bit new to plsql programming, i have a small problem as follows
    I have to call a shell script from a pl/sql procedure ..
    Please suggest me some methods in oracle 10g, which i could make use of to achieve my goal. also please tell me what are the constraints for those methods if any.
    I already came across dbms_scheduler, but i have got a problem and its nor executing properly its exiting giving 255 error or saying that permission problem, but i have already given full access to my shell scripts.
    Thanks in advance
    Best Regards
    Satya

    Hi,
    Read this thread, perhaps is there your response :
    Host...
    Nicolas.

  • How EFI shell can help you backup a non-bootable Mac

    I hope this post will help someone in my situation who need an emergency method to backup a non-bootable Mac.
    Last week, I have to deal with a MacMini (Mid 2010 with Snow Leopard installed) which worked only 5 months until it froze and gave the following error at startup:
    panic (cpu 0 caller0x55a1eb): Unable to find driver for this platform: “ACPI”
    “You need to restart your computer…”
    The same black screen with “You need to restart your computer…” text appeared when I tried to boot from the Snow Leopard DVD holding the C key. Also, error appeared when I tried to boot by holding the Shift key for Safe Boot mode or Cmd+S for Single-User mode.
    So I decided to extract all valuable data and send it to an Apple service. Since, I was unable to boot even from a DVD, I tried r-Studio Emergency CD Demo, which worked fine, but the demo allows only files less than 64K to be recovered.
    Then I found rEFIt site and created a bootable CD. It started fine and by using the shell I found that there is a copy command that may help me save some data on an USB flash memory. Unfortunately, rEFIt site lacks any information how to use EFI shell, but finally on other sites related to Intel EFI, I found that this shell is just a DOS box. So here are some useful commands that you may use in order to backup your data from a non-bootable Mac:
    1. You have to create a bootable rEFIt CD. Follow the instructions here:
    http://refit.sourceforge.net/
    2. Insert the CD and boot you Mac by holding the C key.
    3. When the rEFIt boot menu appears select EFI Shell icon.
    4. In the shell:
    Use "map" command to list all devices. I didn't find how to list them page by page, so you will see only the end of the listing:
    map
    Use "map -r" to remap all devices and assign them a letter. For example if you want to connect a USB flash drive:
    map -r
    Now, you are ready to backup your files. Begin by typing "fs0:" to enter in the first drive:
    fs0:
    Then "ls -b" to list files page pay page:
    ls -b
    fs0 is most probably your CD. Try with "fs1:", "fs2:" until you see your internal drive as well as USB drive. You will recognize internal drive by existence of folders like "Library", "System", "Users", etc. Finally, you are ready to copy your valuable data by "cp" or "cp -r" (for folders) command. Let's suppose your internal drive is fs1 and USB drive is fs3:
    fs1:cd Userscd <your user>cd Desktopmkdir fs3:\Backupls -bcp somefile.zip fs3:\Backup\
    This is DOS, so use "\" for paths. Of course, you will lose Mac OS X attributes such as owner, user rights, attached system information (such as Spotlight comment) and resource forks. But unless your files use resource forks (used mostly in Mac OS 9) you can safely backup using the cp command. If you need full list of EFI shell commands you can type "help" in the shell or "help cp", "help map", etc. or search for "EFI Shell commands" in Google.
    Don't copy anything from your internal drive back to it. It may be damaged. Always copy from the internal drive to your external USB drive.

    Thanks for posting this, I've used rEFIt in the past for my multi-boot Mac (4 operating systems) however never explored the EFI enviroment.
    So Mac's are running DOS? Who would have guessed that?
    Too bad rEFIt hasn't seen any updates of as late, don't know how well it's going to agree with the new Lion and firmware updates.

  • 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;
    }

  • Using Shell commands in AWK

    Hi, i want to use tr command in awk. Please guide me. Also, how to use shell variables in awk?

    please help

  • Shell script in Applescript

    I have a program that I run via Terminal, but I don't want a terminal window open while I run it (Just personal preference). I have an applescript set up to run the Terminal command, but the thing is that the command is "on" while the program is running, Is there some way that I can have the command go and then end the script wihtout closing the program? Or am I out of luck and have to have the Terminal window open?
    The program I am using is located here http://sites.google.com/site/sc2gears/
    Thanks for the help!

    The program is distributed (according to the docs) as a .command file, so you can get the efect you want like so:
    do shell script "/Users/yourname/further/path/Sc2gears-os-x.command &> /dev/null &"
    the &> /dev/null tells applescript that you don't care about any output, so it moves on to the next command, and the closing & sets the process up as a standalone.  Note:
    If the process doesn't close itself automatically you'll need a separate way of doing that
    if the process produces output you want to keep, don't use /dev/null - use an appropriate file path
    (obviously) '/Users/yourname/further/path' needs to be replaced with the correct path to the command, and needs to be single-quoted/escaped if it contains spaces or other unix-confounding characters

  • Shell commands in pl/sql

    Hi i´m having trouble using this:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:6113176678923179734::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:16212348050
    the code i used is:
    create or replace procedure host( cmd in varchar2 ) as
    status number;
    begin
    dbms_pipe.pack_message( cmd );
    status := dbms_pipe.send_message( 'HOST_PIPE' );
    if ( status <> 0 ) then
         raise_application_error( -20001, 'Pipe error' );
    end if;
    end host;
    I've granted the privileges to run dbms_pipe, BUT when i try to use it, it gets stuck while trying to run :
    exec host('ls -l')
    it doesn't respond....
    then i tryed the part where it uses a shell to see what the procedure is doing, the code is:
    #!/bin/csh -f
    sqlplus tkyte/tkyte <<"EOF" | grep '^#' | sed 's/^.//' > tmp.csh
    set serveroutput on
    declare
    status number;
    command varchar2(255);
    begin
    status := dbms_pipe.receive_message( 'HOST_PIPE' );
    if ( status <> 0 ) then
    dbms_output.put_line( '#exit' );
    else
    dbms_pipe.unpack_message( command );
    dbms_output.put_line( '##!/bin/csh -f' );
    dbms_output.put_line( '#' || command );
    dbms_output.put_line( '#exec host.csh' );
    end if;
    end;
    spool off
    "EOF"
    chmod +x tmp.csh
    exec tmp.csh
    I supose it runs ok, becouse it creates a file named tmp.sch, but i can't really be sure becouse the previous part can't be done.
    another question is that what does tom mean when he says "running this in the background", do i have to do it o does it do it itself.
    what i need to do with this is send a file trough ftp, i've been using this shell named A-ftp.txt:
    ftp -v -n 10.128.0.89 << EOF
    user username password
    bin
    put "$1"
    bye
    EOF
    where $1 is the name of the file. so when i try it trough my procedure it would be:
    exec host('A-ftp.txt name-of-file')
    but it olso gets stuck. I need this urgent!!!! what is the problem??? is there another solution to my problem?? is dbms_pipe the only way???
    the code is the same as in the web page were i retrieved it, so i need to be given instructions in what to change and what to leave it as it is.
    Restrictions:
    I can only use pl/sql
    I have little time
    Thank You in advance

    Restrictions:
    I can only use pl/sql
    I have little timeYou don't say which version of the database you are using. If it's 9.2 or higher you should check out Tim Hall's PL/SQL ftp implementation.
    Cheers, APC

  • Linux shell commands through linux

    i am trying to run shell comands through java.
    so far i hav been success ful in running some of them. but when ever a '\' symbol is encountered it doesnt work.
    i use
    process p = Runtime.getRuntime().exec(command)
    example
    command= "mount -t smbfs //192.168.10.150/abcd /home/lan" works fine
    but "mount -t smbfs //192.168.10.34/english\\ songs /home/lan"
    does not work
    is there a way to bypass writing a shell script and executing it?
    i just want to execute it directly without writing it in a shell file first.

    yes there are spaces in the path name thats why im using '\'. and yes in the string i do write it as '\\'. it displays the correct path name using println in the terminal but doesnt run using exec(). im aware of the temp.sh way and i know it works but im working on a networking project and want to avoid writing to a file again and again.
    the other constructor of exec seems interesting. ill try it.

  • 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_;
    }

  • 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?

Maybe you are looking for

  • Curve 8520 browser problems - please help!

    I've had my Curve 8520 for three weeks and it was working like a dream. However, yesterday evening, the browser application suddenly stopped working. I know it's not an issue with my wi-fi, as my laptop is still working fine. When I try to load the b

  • Playlists not showing up in folders in Front Row 1.2.1

    Just installed the Front Row update on my G5 iMac and I was psyched because I would now be able to see shared music in the Front Row interface. However, I was dismayed to find that no playlists showed up if those playlists were located in playlist fo

  • You know about ipad have siri

    you know about ipad have siri

  • Red orange flash on startup then black screen

    My macbook was working well one second, and thewn the screen went black. I tried rebooting, but i get a quick red/ orange flash on startup and then a solid black screen. The computer still works, I'm listening to music from it as I write this... Base

  • SAP Language Problem

    Dear All We have installed chinese language and everthing we on well and we are able to login with chinese language also,however portion of the SAP standard menu like Logistics and the subtrees under it is still appearing in English.So kindly help us