I'm trying to write a very simple mkcd command:  #!/bin/bash mkdir $1 cd $1   The directory is created but the change directory part doesn't seem to run.  Update based on comment:  mkcd () {   mkdir "$1"   cd "$1" }   I'm trying to run it first as a local file:  ./mkcd   My end location is /opt/bin, neither location seems to work.
122854
I wrote a script for the purpose of changing directory and then scan a file.  #!/bin/bash model_dir=/mypath  function chdir () {   cd $1 } chdir ${model_dir}/config if [[ ! -s *.cfg ]] then   echo `date` "configure file does not exist"   exit 1 fi   I don't why my current directory is not changed after I execute this script with source myscript.sh.
98139
Let's suppose I have compiled something and I run it like so:  $ /path/to/my/executable/mycmd Hello World   What do I need to do to run it like   $ mycmd Hello World    from everywhere in my computer?
60999
Whatever I try to run, I get the error:   The command could not be located because '/usr/bin' is not included in the PATH environment variable.   I had some modification in my .bashrc file but then removed the two additional lines afterwards. However somehow the PATH variable seems to have been destroyed.
1590
I'm trying to write a small script to change the current directory to my project directory:  #!/bin/bash cd /home/tree/projects/java   I saved this file as proj, added execute permission with chmod, and copied it to /usr/bin. When I call it by: proj, it does nothing. What am I doing wrong?
43281
I frequently login to a server, then cd into a specific directory. Is it possible to simplify these two commands into one?   ssh bob@foo   cd /home/guest   I'd like to avoid changing anything on 'foo' if possible, as I'll have to clear it with the server administrator. I use bash, but I am open to answers in other shells.
10053
I would like to create an alias to rm command in order to have a confirmation message after executing this command. So I am creating an alias like this alias rm='rm -i'. But as far as I know this is a temporary alias and it lives until you close the terminal.  As it is explained  to save alias permanently I need to execute ~/.bash_aliases or ~/.bashrc commands in terminal and add my alias there. But when I execute ~/.bashrc I get following error message :  bash: /home/bakhtiyor/.bashrc: Permission denied   When I run ~/.bash_aliases I get another error message like this:  bash: /home/bakhtiyor/.bash_aliases: File or directory doesn't exist.   What is the actual problem and how can I solve it?
52196
I want to copy a directory from one place to another folder.   sudo cp is the command, but after that what should I type? The destination or source first?
15047
Quite often I need to perform this two commands:  mkdir abc cd abc   I am curious whether there is a simple command (or an alias that I can create and use) to do it in one go, like  user@GROUP:~$ mdcd abc user@GROUP:~/abc$   Is this possible?
28636
I read this up on this website and it doesn't make sense.       When UNIX was first written, /bin and   /usr/bin physically resided on two   different disks: /bin being on a   smaller faster (more expensive) disk,   and /usr/bin on a bigger slower disk.   Now, /bin is a symbolic link to   /usr/bin: they are essentially the   same directory.   But when you ls the /bin folder, it has far less content than the /usr/bin folder (at least on my running system).  So can someone please explain the difference?
111238
I'm try to change to my Desktop directory from the terminal.  Running  cd /home/desktop   gives an error in the terminal saying no directory found.  What am I doing wrong?
71753
I've seen in many places used install -d to create directories and install -c to copy a file. Why not use mkdir and cp? Is there an advantage in using install?
121065
How can I check if /bin/x86_64/bin/ls is a directory in a bash shell script  Here is what I tried:  #!/bin/bash  if [ $# -eq 2 ]; then     if [[ "$1" = /* ]]     then     cd ./bin/x86_64/bin/ls         if [ -d "$1" ]; then             echo "ok"             i="$1"             echo $i         else             echo "error2"             exit         fi     else         echo "error"         exit     fi fi
76834
How can I make a directory on the desktop?  I tried cd /desktop command but it gives an error  no such file or directory.  What's the correct command?
83338
Possible Duplicate:          For example the following are the same  # /usr/bin/php updateDatabase.php  # php updateDatabase.php   But how would I infer the location of the php command to be in /usr/bin?
44552
I have a program that is installed in a custom directory under /opt. To make it easier to run it, I edited my bashrc to add said directory to my path: export PATH=$PATH:/opt/godi/bin:/opt/godi/sbin  This works fine if I want to run the program without sudo. However, if I try to run it with sudo it fails with a &quot;command not found&quot; error. $ sudo godi_console sudo: godi_console: command not found  Inspecting the PATH variable after using sudo reveals that its not including the same PATH I have as a normal user: $ sudo sh # echo $PATH                  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  Why is the PATH not the same? Am I doing something wrong? I'm on Debian Jessie, if it makes a difference. One thing I tried was to invoke /opt/godi/sbin/godi_console directly, passing the absolute path to the executable. Unfortunatelly, that didn't help in this particular case because godi_console itself depends on the PATH being correctly set.
90507
I have a directory named:  -2   I want to cd into it but the cd complains:  bash: cd: -2: invalid option   With no success, I've tried:  cd "-2" cd '-2' cd \-2   Any solution?  Edit: no file browsers like mc, etc. available on the server.
72629
Let's say the directory ~/this_dir doesn't exist.  I need to be able to run touch ~/this_dir/new.txt to create new.txt in ~/this_dir.  Is there a simple way to make touch also create the directory?  Or an alternative command which would achieve the same thing?  Thanks