Find the answer to your Linux question:
Results 1 to 3 of 3
i use debian unstable. here's the silly problem 1. no manpages for cmds like 'cd' 'exec' etc ... 2. i have an executable file, named 'mycd', in my PATH which ...
  1. #1
    Just Joined!
    Join Date
    Sep 2003
    Posts
    5

    silly problem

    i use debian unstable. here's the silly problem
    1. no manpages for cmds like 'cd' 'exec' etc ...

    2. i have an executable file, named 'mycd', in my PATH which contains just the following one line ..

    cd /tmp

    obviously, the goal is to change the directory to /tmp and BE THERE when i execute mycd command. but it runs a child process, goes to that directory (/tmp), completes and exits the child process and gets back to $PWD. i don't want that. so any way out ?? i could run mycd by 'sourcing' it :

    . mycd

    and achieve the desired goal, but i dont want to do that.

    u might question why at all ? well the actual requirement is not this stupid. its a small part of a bigger and different goal.

    kapat

  2. #2
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Buenos Aires, Argentina
    Posts
    908
    Then it has to cd to /tmp before it runs the child process.
    serzsite.com.ar
    "All the drugs in this world won\'t save you from yourself"

  3. #3
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    1. 'cd' and 'exec' are commands that are built-in to the shell. If you run the man pages on bash, it'll help you figure that out. As I'm on a Windows machine at this time, I don't know the command off the top of my head but try "bash -c help"

    2. The shell will always fork and exec a whatever it needs to run. If you don't want this happening, then just run "exec" followed by whatever you are running.
    The best things in life are free.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •