cd

Change directory command in Docker?

霸气de小男生 提交于 2019-11-26 22:34:57
问题 In docker I want to do this: git clone XYZ cd XYZ make XYZ However because there is no cd command, I have to pass in the full path everytime (make XYZ /fullpath). Any good solutions for this? 回答1: You can run a script, or a more complex parameter to the RUN. Here is an example from a Dockerfile I've downloaded to look at previously: RUN cd /opt && unzip treeio.zip && mv treeio-master treeio && \ rm -f treeio.zip && cd treeio && pip install -r requirements.pip Because of the use of '&&', it

How to cd into a directory with space in the name?

早过忘川 提交于 2019-11-26 22:20:28
I tried a lot of things. See below: Attempt to get into the directory: /cygdrive/c/Users/my dir/Documents $ DOCS="/cygdrive/c/Users/my\ dir/Documents" $ echo $DOCS /cygdrive/c/Users/my\ dir/Documents $ cd $DOCS -bash: cd: /cygdrive/c/Users/my\: No such file or directory $ cd /cygdrive/c/Users/my\ dir/Documents (success) Very weird behaviour. When I manually type it in, the backspace does its escape character thing. But not when I use parameter expansion with the variable DOCS. I tried other variations such as no backslash. $ DOCS=/cygdrive/c/Users/Rahman\ dir/Documents $ echo $DOCS /cygdrive/c

How to use “cd” command using Java runtime?

蓝咒 提交于 2019-11-26 18:57:37
I've created a standalone java application in which I'm trying to change the directory using the "cd" command in Ubuntu 10.04 terminal. I've used the following code. String[] command = new String[]{"cd",path}; Process child = Runtime.getRuntime().exec(command, null); But the above code gives the following error Exception in thread "main" java.io.IOException: Cannot run program "cd": java.io.IOException: error=2, No such file or directory Can anyone please tell me how to implement it? Joachim Sauer There is no executable called cd , because it can't be implemented in a separate process. The

system(“cd <path>”) in a C program

爷,独闯天下 提交于 2019-11-26 18:00:47
I'm trying to use the system() function in a C program. For example, I tried to create a directory on my desktop, using the system() function. My code: #include <stdio.h> #include <stdlib.h> int main(void) { system("cd c:\\Users\\USER\\Desktop"); system("mkdir test"); return 0; } When I run this code, a directory is created, but not on my desktop. It is created in my project directory. Why is this happens? Can I use the cd command in the system() function? If not, is there an replacement to the cd command that will work with system()? I'm using Windows OS. I'm trying to use system() from a C

How do I find the current directory of a batch file, and then use it for the path?

佐手、 提交于 2019-11-26 10:56:45
问题 I have a batch file that I intend to distribute to our customers to run a software task. We distribute them as a folder or .zip with the files inside. Inside, there is the batch files and another folder with the files needed to run the batch. Normally, when you make a batch, you type the path where the files are. But I won\'t know where the files are. The files will still be kept inside the master folder, but I need to have the batch find that folder to run the files. So for example: If they

How to use “cd” command using Java runtime?

ⅰ亾dé卋堺 提交于 2019-11-26 06:42:51
问题 I\'ve created a standalone java application in which I\'m trying to change the directory using the \"cd\" command in Ubuntu 10.04 terminal. I\'ve used the following code. String[] command = new String[]{\"cd\",path}; Process child = Runtime.getRuntime().exec(command, null); But the above code gives the following error Exception in thread \"main\" java.io.IOException: Cannot run program \"cd\": java.io.IOException: error=2, No such file or directory Can anyone please tell me how to implement

How to cd into a directory with space in the name?

帅比萌擦擦* 提交于 2019-11-26 06:39:28
问题 I\'m attempting to get into the directory /cygdrive/c/Users/my dir/Documents : $ DOCS=\"/cygdrive/c/Users/my\\ dir/Documents\" $ echo $DOCS /cygdrive/c/Users/my\\ dir/Documents $ cd $DOCS -bash: cd: /cygdrive/c/Users/my\\: No such file or directory $ cd /cygdrive/c/Users/my\\ dir/Documents (success) When I manually type it in, the backspace does its escape character thing, but not when I use parameter expansion with the variable DOCS . I tried other variations such as no backslash. $ DOCS=

system(“cd <path>”) in a C program

本秂侑毒 提交于 2019-11-26 06:08:32
问题 I\'m trying to use the system() function in a C program. For example, I tried to create a directory on my desktop, using the system() function. My code: #include <stdio.h> #include <stdlib.h> int main(void) { system(\"cd c:\\\\Users\\\\USER\\\\Desktop\"); system(\"mkdir test\"); return 0; } When I run this code, a directory is created, but not on my desktop. It is created in my project directory. Why is this happens? Can I use the cd command in the system() function? If not, is there an

Run cmd commands through Java

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-25 23:37:40
问题 I found several code snippets for running cmd commands through a Java class, but I wasn\'t able to understand it. This is code for opening the cmd public void excCommand(String new_dir){ Runtime rt = Runtime.getRuntime(); try { rt.exec(new String[]{\"cmd.exe\",\"/c\",\"start\"}); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } And I found some other links for adding other commands such as cd http://www.coderanch.com/t/109753/Linux-UNIX/exec-command-cd