Unable to cd into a grepped directory - grep

I have a volume with spaces and periods that I am unable to cd into
bash-4.3$ ll /Volumes
total 8
drwxrwxrwt# 4 root admin 136 Apr 17 11:08 .
drwxr-xr-x 33 root wheel 1190 Feb 5 19:05 ..
lrwxr-xr-x 1 root admin 1 Apr 17 09:41 Macintosh HD -> /
drwxr-xr-x 4 username wheel 204 Jan 28 02:54 OS X 10.10.2 Update Combo
but trying to cd in this way yields
bash-4.3$ cd "$(ls /Volumes |grep 'OS X')"
bash: cd: OS X 10.10.2 Update Combo: No such file or directory

The problem, as indicated by RC in their comment is that the output from that command substitution is the bare directory name OS X 10.10.2 Update Combo which then is used as cd "OS X 10.10.2 Update Combo" but there is no such directory in the current directory. You would need cd /Volumes/"$(ls /Volumes |grep 'OS X')" to do what you wanted.
That being said using ls and grep for this is not at all appropriate. A better solution is simply to use a glob.
cd /Volumes/*"OS X"*
This will fail (as would the original) if more than one directory/file matches the glob however.

Related

"command not found" in zsh after adding a command into /usr/local/bin

~ ll /usr/local/bin| grep vrl
-rwxrwxrwx 1 root root 31K 9月 29 09:38 vrlsubmit
➜ ~ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
➜ ~ vrlsubmit
zsh: command not found: vrlsubmit
Finally somebody helped me:
Root cause is:
I am trying to exec a 32bit command in 64bit system
Debug:
> file submit # < submit stands for the command >
submit: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.2.5, not stripped
> ls /lib | grep ld
compat-ld
gold-ld
Based on above "file submit", it tells "interpreter /lib/ld-linux.so.2" needed. But there are no /lib/ld-linux.so.2 file at all!!!
Solution:
sudo apt-get install lib32z1 -y
submit
Error: Missing one or more required arguments.
submit
Finished to resolve this issue!

react-native run-ios Could not connect to development server npm: '7.19.1' and node : 16.6.0, macincloud.com enviorment

I am using a rdp machine on macincloud.
i am running below commands and failing with "Could not connect to development server"
react-native run-ios
error:
[![enter image description here][1]][1]
Could not connect to development server.
Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
- WiFi is enabled and connected to the same network as the Node Server
URL: http://103.228.153.185:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.Appui
RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start
0x0
additionally though the debugger connects http://103.228.153.185:8081/debugger-ui/
but in console there is failure with attaching screenshot
i have also added url in Appdelegate.m
return [NSURL URLWithString:#"http://103.228.153.185:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.AppUI"];
i have removed the node_module, clear temp directory,started node server with clean cache, did npm install, nothing seems to work.
other enviorment spec:
node : 16.6.0
npm version
{
npm: '7.19.1',
node: '16.6.0',
v8: '9.2.230.21-node.18',
uv: '1.41.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.17.1',
modules: '93',
nghttp2: '1.42.0',
napi: '8',
llhttp: '6.0.2',
openssl: '1.1.1k+quic',
cldr: '39.0',
icu: '69.1',
tz: '2021a',
unicode: '13.0',
ngtcp2: '0.1.0-DEV',
nghttp3: '0.1.0-DEV'
}
I think this is a environment issue, Any help would be greatly appreciated
Note: app works fine in android
RCA:
This is happening because react-native needs watchman to run in ios, at the same time my user in macincloud.com didn't have privilege to access the watchman that is installed in the machine.
I saw the lack of access privilage from the "npm start" start log.
Welcome to Metro!
Fast - Scalable - Integrated
To reload the app press "r"
To open developer menu press "d"
2021-09-17T19:36:21,739: [] while computing sockname: failed to create /usr/local/var/run/watchman/user-state: Permission denied
Watchman: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2021-09-17T19:36:21,739: [] while computing sockname: failed to create /usr/local/var/run/watchman/user-state: Permission denied
Solution:
From the error it was obvious that watchman is installed ,but user name cant access it, So what i did is i copied the folder of watchman to a location that i can access and provided the same path in bashrc. As to how i decided which path is needed to go to bashrc. I checked the installation step of watchman on https://facebook.github.io/watchman/docs/install.html,
if you see in the mac installation section, they only copy bin and lib like the below command, note:react-native is not concerned about exact location of watchman, all it wants is to access watchman.
$ sudo cp bin/* /usr/local/bin
$ sudo cp lib/* /usr/local/lib
Exact steps to follow to make this issue go away in macincloud.com or any machine where you are not root and do not have access privilage
cd /Users/{place-your-username}/Documents
mkdir watchman
cd /usr/local/bin/
ls -lart|grep watchman
lrwxr-xr-x 1 temp admin 45 Sep 17 23:04 watchman -> ../Cellar/watchman/2021.09.06.00/bin/watchman
lrwxr-xr-x 1 temp admin 50 Sep 17 23:04 watchman-diag -> ../Cellar/watchman/2021.09.06.00/bin/watchman-diag
lrwxr-xr-x 1 temp admin 50 Sep 17 23:04 watchman-make -> ../Cellar/watchman/2021.09.06.00/bin/watchman-make
lrwxr-xr-x 1 temp admin 68 Sep 17 23:04 watchman-replicate-subscription -> ../Cellar/watchman/2021.09.06.00/bin/watchman-replicate-subscription
lrwxr-xr-x 1 temp admin 50 Sep 17 23:04 watchman-wait -> ../Cellar/watchman/2021.09.06.00/bin/watchman-wait
lrwxr-xr-x 1 temp admin 48 Sep 17 23:04 watchmanctl -> ../Cellar/watchman/2021.09.06.00/bin/watchmanctl
Note: from above you see wathman is present in the machine, for the below command change the version number with respect what you get in the above response
cp -r ../Cellar/watchman/2021.09.06.00/ /Users/{place-your-username}/Documents/watchman
echo $PATH
bashrc might not be present at all and you have to create it for the first time,its ok
vi ~/.bashrc
PATH:/Users/{place-your-username}/Documents/watchman/bin:/Users/{place-your-username}/Documents/watchman/lib:{add-response from above function here or just add $PATH}
source ~/.bashrc
Now you can start your react machine
Note: This should work all machines where you want access to certain app which you want access to but due to privilege you are blocked

How do I run objcgen directly to do .NET Embedding on MacOS

I followed the instructions at Installing .NET Embedding and...
I installed Visual Studio 2019 on my Mac 10.14.6
I created a Xamarin.ios class lib project
I installed Nuget Embeddinator-4000
I added a hello world function: void main(){ Console.WriteLine("hello world");}...
I built without problem.
The next instruction says to.....
Running manually
Now that the NuGet is installed, you can run the tooling by hand.
Open a Terminal (macOS) or Command Prompt (Windows)
Change directory to your solution root
The tooling is installed in:
./packages/Embeddinator-4000.[VERSION]/tools/objcgen (Objective-C)
./packages/Embeddinator-4000.[VERSION]/tools/Embeddinator-4000.exe
On macOS, objcgen can be run directly.
...But there is no ./packages/ directory <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> Last login: Fri Mar 6 10:05:48 on ttys002
> DOUGs-MacBook-Pro:Embedding_2020-03-06 dbell$ ls -l total 24
> -rw-r--r-- 1 dbell staff 2193 Mar 6 09:02 Embedding_2020-03-06.csproj
> -rw-r--r-- 1 dbell staff 827 Mar 6 08:58 Embedding_2020-03-06.sln
> -rw-r--r-- 1 dbell staff 249 Mar 6 09:03 HelloWorld.cs drwxr-xr-x 3 dbell staff 96 Mar 6 08:58 Properties drwxr-xr-x 3 dbell
> staff 96 Mar 6 08:58 bin drwxr-xr-x 8 dbell staff 256 Mar 6
> 09:03 obj DOUGs-MacBook-Pro:Embedding_2020-03-06 dbell$ ls ./packages
> ls: ./packages: No such file or directory <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> DOUGs-MacBook-Pro:Embedding_2020-03-06 dbell$
Ah, hah! The objcgen tools need to first be built. I found instructions how at Github > Embeddinator-4000 > README.md > "Building".
Summary -- installation of .NET to Objective-C converter...
1. Clone github > Embeddinator-4000
git clone https://github.com/mono/Embeddinator-4000.git
2. cd into the cloned dir
3. Install other stuff:
git submodule update --recursive --init
4. Build the .NET to Objective-C converter:
cd objcgen
make
5. Build the 'wrapper' (ie. command access) to objcgen (took 10-15 minutes for me):
make nuget
6. Generate Objective-C from your .NET C# class lib
7. <somewhere in the bowels of your Mac>/Embeddinator-4000/objcgen/_build/objcgen <elsewhere in the bowels of your Mac>/hello-from-csharp/hello-from-csharp/bin/Debug/hello_from_csharp.dll --target=framework --platform=iOS --outdir=output -c --debug
NOTE: hello-from-csharp is from MICROSOFT DOC .NET EMBEDDING HELLO WORLD

While creating a project specific gemset for a new rails application, got this error: .ruby-version is not empty, moving aside to preserve

Specifically, this is what I typed into terminal and what came back:
$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.1.0#myapp --ruby-version --create
ruby-2.1.0 - #gemset created /usr/local/rvm/gems/ruby-2.1.0#myapp
ruby-2.1.0 - #generating myapp wrappers.
Using /usr/local/rvm/gems/ruby-2.1.0 with gemset myapp
.ruby-version is not empty, moving aside to preserve.
.ruby-gemset is not empty, moving aside to preserve.
$ ls -la .ruby*
-rw-rw-r-- 1 danisyellis staff 6 Jan 24 14:26 .ruby-gemset
-rw-rw-r-- 1 danisyellis staff 6 Jan 24 14:26 .ruby-gemset.01.24.2014-14:26:06
-rw-rw-r-- 1 danisyellis staff 11 Jan 24 14:26 .ruby-version
-rw-rw-r-- 1 danisyellis staff 11 Jan 24 14:26 .ruby-version.01.24.2014-14:26:06
$ cat .ruby*
myapp
myapp
ruby-2.1.0
ruby-2.1.0
I've searched the internet for that error message and haven't found anything that explains it so I don't know what it means.
It almost looks like my computer ran the command twice and tried to create a duplicate?
Questions:
Is that what happened or was it something else?
If yes, why did it do that?
What does "moving aside to preserve" mean?
Is there anything I can change/clean up so that everything works properly and cleanly
Thanks so much for any help you can give! I'm pretty new to all this so answers with a decent amount of detail/hand-holding would be appreciated.
this looks like a bug, please report it here: https://github.com/wayneeseguin/rvm/issues
in the mean time ignore this bug, you can remove the duplicate files quite easily:
rm -f .ruby-*\.*

can sombody assis with installing symfony please?

yikes i have forgotten but am following:
http://www.symfony-project.org/getting-started/1_4/en/03-Symfony-Installation
i have a jobeet directory and want to install symfony-1.4.16 here.
i downloaded symfony-1.4.16.tgz and unpacked it with tar zxpf symfony-1.4.16.tgz
then moved it mv symfony-1.4.16 symfony
and removed the tgz with rm symfony-1.4.16.tgz
i have this now:
helloises#helloise:~/jobeet$ ls -lah
total 7.2M
drwxr-xr-x 3 helloises helloises 4.0K 2012-01-09 15:06 .
drwxr-xr-x 83 helloises helloises 4.0K 2012-01-09 14:59 ..
-rw-r--r-- 1 helloises helloises 593K 1970-01-01 11:13 package.xml
-rwxr-xr-x 1 helloises helloises 3.6M 2012-01-04 09:13 symfony-1.2.12.tgz (is in GREEN)
drwxr-xr-x 5 helloises helloises 4.0K 2012-01-09 15:06 symfony (is in BLUE)
-rw-r--r-- 1 helloises helloises 3.1M 2012-01-09 15:05 symfony-1.4.16.tgz (is in RED)
huh? dont know what is going on here.. i unpacked version 1.4.16
i run:
helloises#helloise:~/jobeet$ ./symfony generate:project jobeet --orm=Propel
bash: ./symfony: is a directory
any help please?
thanks
You need to make a lib/vendor folder. The symfony folder must be under the vendor folder (*/wherever_my_project_is/lib/vendor/symfony*).
The go up two levels (so you can see the lib folder (if you do a ls) and run
php lib/vendor/symfony/data/bin/symfony -V
If everything is ok, that should return the symfony version.
Then you can generate a new project:
php lib/vendor/symfony/data/bin/symfony generate:project PROJECT_NAME
That will create the necessary directory structure and also make the symfony executabile for you (in your project directory). See more here. I recommend reading A Gentle Introduction to symfony tutorial.

Resources