cd

Shell Script thinks directory does not exist when running cd

对着背影说爱祢 提交于 2019-12-01 19:52:53
问题 I have a shell script (which I source into .bashrc) that allows me to jump to my projects directory from anywhere. cdp(){ proj="~/dev/projects/$@/" builtin cd $proj } _my_cdp() { local cur opts cur="${COMP_WORDS[COMP_CWORD]}" opts=$(ls ~/dev/projects/) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) } complete -o nospace -F _my_cdp cdp The problem is, the cd on line 3 says: bash: cd: ~/dev/projects/jsonparse/: No such file or directory Here is the full console output showing the error and

Bash script to change parent shell directory [duplicate]

喜欢而已 提交于 2019-12-01 17:09:59
This question already has an answer here: Why doesn't “cd” work in a shell script? 29 answers What I'm trying to do I've created a shell script that I've added to my $PATH that will download and get everything setup for a new Laravel project. I would like the script to end by changing my terminal directory into the new project folder. From what I understand right now currently it's only changing the directory of the sub shell where the script is actually running. I can't seem to figure out how to do this. Any help is appreciated. Thank you! #! /usr/bin/env bash echo -e '\033[1;30m=============

Bash script to change parent shell directory [duplicate]

守給你的承諾、 提交于 2019-12-01 15:23:39
问题 This question already has answers here : Why doesn't “cd” work in a shell script? (29 answers) Closed 4 years ago . What I'm trying to do I've created a shell script that I've added to my $PATH that will download and get everything setup for a new Laravel project. I would like the script to end by changing my terminal directory into the new project folder. From what I understand right now currently it's only changing the directory of the sub shell where the script is actually running. I can't

How to extract values from a java properties files in a bash/shell script and store in a variable and cd to that variable

∥☆過路亽.° 提交于 2019-12-01 06:47:29
问题 I have a config.properties file which contains a path like ouputdir=/data1/testdata/output . I am able to extract these in shell and store this path in a variable. While I am trying to change directory to this path, I am getting error something like: No such file or directory/data1/testdata/output , thouth this path exists. What I tried is: configPath=/data1/testdata.config.properties my_value=$(grep outputdir $configPath| awk -F= '{print $2}') echo $my_value cd $my_value by this I am able to

How to `cd` into directory with the name `-`? [closed]

橙三吉。 提交于 2019-12-01 03:25:14
Here is an example. I'm creating a directory named - and I can't cd into it. The command cd - returnes me to the previous directory. And I'm a bit supprised that cd "-" works the same way. I can enter that directory using the full path ~/- , but is there other way? user@server:~$ cd /tmp user@server:/tmp$ cd user@server:~$ mkdir - user@server:~$ cd - /tmp user@server:/tmp$ cd user@server:~$ cd "-" /tmp user@server:/tmp$ cd ~/- user@server:~/-$ use instead cd ./- if you are in the directory above. or like this: cd -- -/ Adding a / at the end of a file name ensures that the file is treated as a

How to `cd` into directory with the name `-`? [closed]

别等时光非礼了梦想. 提交于 2019-12-01 00:08:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Here is an example. I'm creating a directory named - and I can't cd into it. The command cd - returnes me to the previous directory. And I'm a bit supprised that cd "-" works the same way. I can enter that directory using the full path ~/- , but is there other way? user@server:~$ cd /tmp user@server:/tmp$ cd

Identifying CDs

試著忘記壹切 提交于 2019-11-30 22:20:10
I'd like to be able to determine what music album CD is in a CD drive. For example, if someone claims that the CD in their drive is Eminem - The Eminem Show, I would like to be able to verify that the CD is indeed The Eminem Show. Any ideas? I've applied for a Gracenote developer license, but they won't get back to me for five days. Also, how does this work? Is there some GUID or other unique identifier that music discs are encoded with? Lastly, might this be possible with data CDs, like, say, the Diablo II install Disc 1? If so, any directions you can point me in, for accomplishing this? You

bash expand cd with shortcuts like zsh

丶灬走出姿态 提交于 2019-11-30 14:28:35
Is it possible in bash to expand something like cd /u/lo/b <hit tab> to cd /usr/local/bin ? Aserre Sorry I couldn't post earlier, I was held at work, and the bind function was more issue-prone than I first thought. Here is what I came up with : Bind the following script : #!/bin/bash #$HOME/.bashrc.d/autocomplete.sh autocomplete_wrapper() { BASE="${READLINE_LINE% *} " #we save the line except for the last argument [[ "$BASE" == "$READLINE_LINE " ]] && BASE=""; #if the line has only 1 argument, we set the BASE to blank EXPANSION=($(autocomplete "${READLINE_LINE##* }")) [[ ${#EXPANSION[@]} -gt 1

bash expand cd with shortcuts like zsh

旧城冷巷雨未停 提交于 2019-11-29 20:43:28
问题 Is it possible in bash to expand something like cd /u/lo/b <hit tab> to cd /usr/local/bin ? 回答1: Sorry I couldn't post earlier, I was held at work, and the bind function was more issue-prone than I first thought. Here is what I came up with : Bind the following script : #!/bin/bash #$HOME/.bashrc.d/autocomplete.sh autocomplete_wrapper() { BASE="${READLINE_LINE% *} " #we save the line except for the last argument [[ "$BASE" == "$READLINE_LINE " ]] && BASE=""; #if the line has only 1 argument,

Disable the use of CD drive (VB.NET)

℡╲_俬逩灬. 提交于 2019-11-29 17:31:27
I have a task and no idea how to tackle it! Basically, I want to disable the CD drive on a PC so our users can't use them. That's how I want to start anyway - ultimately I'd like an icon in the system tray that allows the CD drive(s) to be locked and unlocked providing you know a password. I need somewhere to start though - does anyone know how to disable the use of a CD drive in VB.net? Any help would be appreciated. Andrew I found a way to do this. Basically I needed to loop through all the items in the device manager like this: search = New System.Management.ManagementObjectSearcher("SELECT