exec ctx_rehash fails with bash: exec: ctx_rehash: not found - ubuntu-20.04

I am in the process of Citrix Workspace on Ubuntu Mate. I have followed the directions provided at this link: https://jamesjmeyer210.github.io/site/blogs/installing-citrix-workspace-on-ubuntu.html
However this command specified on the page for certificate setup fails:
$ exec ctx_reash
bash: exec: ctx_rehash: not found
Running exec without any parameters completes silently, so bash definitely recognizes the command.
I have searched the internet and most of the example show redirect after "exec" and before the file specified.

I had the same challenge (Mint 20.2)
In my case I just ran the ctx_hash file by going to the relevant directory and typing
./ctx_hash
that worked, "exec ctx_hash" will not work. But the file is executable so I didn't need to change permissions or anything and was able to run it fine. This resolved the problem.

Related

WebStorm: bash script errors when run with "run", but works when executed in the console

I wrote a build script for my project (maven, grunt as well as some server-reconfiguration), and when I use the WebStorm command-line with
~/Projects/javaee-angularjs$ ./launchServer.sh
Everything works as expected.
However, when I configure the file to be run by WebStorm (the green triangle top-right) it fails because of: /home/user/Projects/javaee-angularjs/launchServer.sh: line 29: grunt: command not found
The run-config should be absolutely correct:
working directory is the correct one and the script is found to begin with.
Any Idea what could cause this weird behavior?
P.S. I don't know whether WebStorm can run bash natively, since I've always had the bash plugin installed.
Try starting WebStorm from terminal - does the issue persist?
When being launched from desktop/System menu, WebStorm only sees environment variables configured in ~/.profile (login shell), but not in interactive shell configuration files (like ~/.bashhrc). Possible workarounds:
Workaround 1: make required variables available in a login shell (i.e. for bash, move them from .bashrc to .bash_profile).
Workaround 2: run IDE from a terminal, via bin/webstorm.sh
Workaround 3: edit the desktop launcher and set command to /bin/bash -l -i -c "/path/to/webstorm.sh"
see also https://youtrack.jetbrains.com/issue/IDEABKL-7589
The error sounds like Webstorm cannot find grun in its path. Try using the full path to the grunt command.

How can I determine where an error message printed during shell startup comes from?

After uninstall Docker on Ubuntu, each time I start a bash shell window, it emits the following hint:
The program 'docker' is currently not installed. You can install it by typing:
sudo apt install docker.io
I have searched in .bashrc, .profile, .bash_profile, but didn't found any lines related to docker.
So, how can I get rid of those tips?
Run PS4=':${BASH_SOURCE}:$LINENO+' bash -x -l -i to log every command in your startup scripts, including which config file or script they came from. Search through that, and you'll find the individual command that's creating this error.
(Note that very new versions of bash ignore inherited values of PS4 when running as root for security reasons. But you're not using root as your primary account... right?)

Running gmt.script

I try to run a gmt-script and get the message:
bash-3.2$ plot_scenario.gmt
bash: plot_scenario.gmt: command not found
Does anyone know what could fix the problem?
I got a script from my supervisor, and it worked just fine on the uni Linux pc.
I have a Mac OS.
When you type text in shell, it tries to look for available commands. Here bash doesn't find any command like plot_scenario.gmt and outputs command not found.
The proper way to execute a file is ./filename where . refers to current directory. But you need to give execution permission to file you want to run. So, following commands may help you:
chmod +x <filename>
./<filename>
Note that make sure your pwd is where you're file is located. Another way to run or execute file is calling the shell:
bash /path/to/file

Simple Bash Script says Command not found

I'm trying to run an extremely simple bash script that runs some commands on the shell. For now, all it is composed of is:
#!/bin/bash
eos
Where "eos" is a perfectly legit command that runs perfectly fine on the server I'm using if I run it manually on the same shell.
However, when I chmod +x and execute this script, I get the error:
./cp.sh: line 21: eos: command not found
Does anyone have any idea why it won't submit these commands?
Thanks in advance!
What user is running the script? I suspect an environment or pwd issue, although permissions are a possibility.
Try using the full path to eos or setup the necessary environment in the script.
In unix shell "command not found" error comes when the directory at which command is located is not in PATH (an env variable) which is searched to locate the command.
The solution to this is either of any of the 2 approaches mentioned below
a) change PATH and export PATH variable either in shell startup files or user profiles
export PATH=$PATH:/eos-command-directory-location/
b) run the eos command in shell script you have developed with full path

Go fork/exec permission denied error

I recently installed Go onto our server with CentOS 6.3. The install appears to have gone fine. However I made a test "hello world" script, and when I run I get the following output.
fork/exec /tmp/go-build967564990/command-line-arguments/_obj/a.out: permission denied
Now running go env or other go commands seem to work. At first I figured it was a permission issue, however running as root user I get the same thing. An
I encountered this issue today but the solutions above did not work. Mine was fixed by simply running:
$ export TMPDIR=~/tmp/
then I was able to get the script to run with:
$ go run hello.go
hello, world
The only downside is you have to run export TMPDIR every time you want to run an application.
Kudos to Adam Goforth
Just guessing: Your nix perhaps disables for security reasons executing programs in /tmp. It might be configurable in CentOS, but I don't know that.
The alternative solution: It seems you're trying go run to execute a Go program (which is as script as C is a script). Try (assuming $GOPATH=~, the easy possibility) instead a normal build, i.e. instead of
me:~/src/foo$ go run main.go
try
me:~/src/foo$ go build # main.go should not be necessary here
me:~/src/foo$ ./foo
This approach will still use /tmp-whatever to create the binary, IIRC, but it will not attempt to execute it from there.
PS: Do not run these command as root. No need for that with correct setup.
I am using Fedora 31 and got a similar error which brought me here. I could not run the Go debugger used by Jetbrains IntelliJ Ultimate/GoLand without fork/exec & permission denied error. The solution was this:
setsebool deny_ptrace 0
See https://fedoraproject.org/wiki/Features/SELinuxDenyPtrace for details.
exec.Command return this sturct: type Cmd
standard comment:
// Dir specifies the working directory of the command.
// If Dir is the empty string, Run runs the command in the
// calling process's current directory.
Dir string
so resolve, you can pass the exec cmd's path to exec yourself command:
cmd := exec.Command(xxxxx)
cmd.Dir = xxxxPath
and then you can call Run() or other Output() func
Instead of settings TMPDIR which might affect other programs, you can set GOTMPDIR:
mkdir /some/where/gotmp
export GOTMPDIR=/some/where/gotmp
Then add export GOTMPDIR=/some/where/gotmp to your profile (i.e. .bash_profile) to make the variable permanent.
To fix this issue on my Chromebook I just remounted /tmp as executable. There may be security implications in doing this, but since go run works on other platforms I figure maybe it's not that bad (especially on a local dev machine):
sudo mount -i -o remount,exec /tmp/
I added this to my .bash_profile script.
Consider trying:
sudo mount -o remount exec /tmp

Resources