config for PATH variable on mac - unix

I have the following env file which is run whenever the shell starts:
PATH=/Users/paulcowan/bin:$PATH
PATH=$PATH:~/bin
PATH=$PATH:$HOME/.local/bin:$PATH
PATH=$PATH:/usr/local/bin:/usr/bin:/bin
PATH=$PATH:"$RBENV_ROOT/bin:$PATH"
export PATH
But when I run echo $PATH
I get:
/Users/paulcowan/.nvm/versions/node/v5.0.0/bin:/usr/local/rbenv/shims:PATH:/Users/paulcowan/.local/bin:/Users/paulcowan/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/local/rbenv/shims:PATH:/Users/paulcowan/.local/bin:/Users/paulcowan/bin:/Users/paulcowan/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/rbenv/bin:PATH:/Users/paulcowan/.local/bin:/Users/paulcowan/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/local/rbenv/shims:PATH:/Users/paulcowan/.local/bin:/Users/paulcowan/bin:/Users/paulcowan/bin:/usr/local/bin:/usr/bin:/bin
With the same values repeating.
How can I properly configure my path?

You repeated the $PATH at the beginning and end of several of the lines:
PATH=$PATH:$HOME/.local/bin:$PATH
PATH=$PATH:"$RBENV_ROOT/bin:$PATH"
Why not just set it like this?
export PATH=/Users/paulcowan/bin:~/bin:$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin:$RBENV_ROOT/bin:$PATH

If I well understood what your script tries to do, the correct code could be:
PATH=/Users/paulcowan/bin:$PATH
PATH=~/bin:$PATH
PATH=$HOME/.local/bin:$PATH
PATH=$PATH:/usr/local/bin
PATH=/usr/bin:$PATH
PATH=/bin:$PATH
PATH=$PATH:$RBENV_ROOT/bin
export PATH

Related

Failed to create wallet for ton with Fift?

Right now I'm trying to create wallet for TON.
I downloaded and built Fift interpreter an was trying to create new wallet with: ./crypto/fift new-walelt.fif
[ 1][t 0][1559491459.312618017][fift-main.cpp:147] Error interpreting standard preamble file `Fift.fif`: cannot locate file `Fift.fif`
Check that correct include path is set by -I or by FIFTPATH environment variable, or disable standard preamble by -n.
Although my path variable is set. Could anyone please help me with this?
First, locate {{lite-client-source-direcotry}}/crypto/fift
This is not the build directory, that's the directory where are the source files (lite-client that you downloaded). So verify you have that it contains Fift.fif file.
If you installed it in the user working directory, it should be:
~/lite-client/crypto/fift/
Now, you should either set FIFTPATH variable to point to this directory or run fift with -I option:
export FIFTPATH=~/lite-client/crypto/fift/
./crypto/fift new-walelt.fif
Or
./crypto/fift -I~/lite-client/crypto/fift/ new-walelt.fif
Have you tried ./crypto/fift -I<source-directory>/crypto/fift new-wallet.fif instead of setting environment variable? Are Fift.fif and Asm.fif library files inside FIFTPATH?
Make sure you have followed all the instruction written here:
https://test.ton.org/HOWTO.txt
It should work if you do all the above instruction correctly. If not, it might be a bug. Remember that TON is in a very early beta strage. You can submit the issue here:
https://github.com/copperbits/TON/issues
You also can use this:
cd ~/liteclient-build
crypto/fift -I/root/lite-client/crypto/fift/lib -s /root/lite-client/crypto/smartcont/new-wallet.fif -1 wallet_name
Try this (worked for me)
export FIFTPATH=~/lite-client/crypto/fift/lib
./crypto/fift new-wallet.fif

PyQt - Qprocess Can not run command "chcp" directly but from batch its fine

The following code working for executing the batch file:
def GetCMD_Encoding(self):
self.CMD = QProcess(self)
self.CMD.setProcessChannelMode(QProcess.MergedChannels)
self.CMD.readyReadStandardOutput.connect(self.EventDataForGetCMDEncoding)
self.CMD.start("chcp.bat")
def EventDataForGetCMDEncoding(self):
output = bytearray(self.CMD.readAllStandardOutput())
output = output.decode("ascii")
print (output)
The content of .bat file is only :
chcp
But if i want to exclude but file and i only execute simple command like:
self.CMD.start("chcp")
it does not working and any kind of signal isnt emit.
Other commands is working like :
self.CMD.start("ipconfig")
self.CMD.start("help")
You should try to
Use the full path of the file chcp.bat
Or add the path of the file chcp.bat to your system PATH
and maybe ensure that the file is executable.

How to get relative path, not full path in map files with Closure Controller? `

I'm using Google Closure Compiler to minify my JS scripts: https://developers.google.com/closure/compiler/docs/gettingstarted_app?hl=en
The command I'm using is:
java -jar /home/user/compiler/compiler.jar --js $File::Find::name --create_source_map $File::Find::name.map --source_map_format=V3 --compilation_level=WHITESPACE_ONLY --js_output_file $minified --charset=Windows-1251 --output_wrapper '%output%\n//# sourceMappingURL=output.js.map'
Thats fine, apart from one thing - the .js.map file has the FULL path for the file, not the relative one:
"version":3,
"file":"/home/user/public_html/new_design/common37.min.js",
"lineCount":375,
....
I assume I can change this in the invocation of the compiler.jar script? Otherwise, I guess I will have to add some more code into my script (not something I want to do, if its possible "out of the box")
EDIT: I've done a little bit of a dirty hack in my Perl script:
# now open the map file one, and edit it to remove the full path.. needs to be relative
my $contents = File::Slurp::read_file("/home/user/public_html/$tmp.map");
$contents =~ s|/home/user/public_html||g;
File::Slurp::write_file("/home/user/public_html/$tmp.map",$contents);
That gets rid of the path info correctly. I've prefer if there were an option to use relative urls in the .map file (compared to the full path it currently puts in)
Thanks!
Specify sourcemap location transformations by using the --source_map_location_mapping flag. The flag expects a value formatted as:
--source_map_location_mapping=/filesystem/src/root|relative/source/root

Windows batch script - parse and expand the variable to pass as a string to external program?

I want to use a relative file path as a command line argument but as the example and assessment below will demonstrate, the variable passes \..\ as a string, it doesn't evaluate it.
Can I can force the command line to parse and expand the variable as a string?
: For example: I have a R script file I want to launch from the command line:
Set RPath=C:\Program Files\R\R-3.1.0\bin\Rscript.exe
SET RScript=%CD%\..\..\HCF_v9.R
SET SourceFile=%CD%\..\Source\
ECHO String used for Source Location - %SourceFile%
"%RPath%" "%RScript%" %SourceFile%
The inclusion of \..\ works in the call to R as an external program because the batch file can resolve it's own commands.
The variable of SourceFile however doesn't work because the SourceFile variable hasn't expanded \..\, it has just included it as part of the string and R can't process \..\
You can use the for replaceable parameters to resolve to the real path
for %%a in ("..\..\HCF_v9.R") do set "RScript=%%~fa"
#MC ND has provided the batch file approach; an R-centric approach would be to pass the current directory to R, and modify it there.
; batch file
Set RPath=C:\Program Files\R\R-3.1.0\bin\Rscript.exe
SET RScript=%CD%\..\..\HCF_v9.R
"%RPath%" "%RScript%" %CD%
# in R
srcpath <- commandArgs(TRUE)[1]
srcpath <- normalizePath(file.path(srcpath, "../Source"))

unix PATH environment variable edit

My PATH environment variable right now is:
./subTmp:/usr/local/bin
How do I remove the ./subTmp part from it?
Thanks.
The details vary a bit by installation and by local custom, but generally you have a file named either .profile, .login, or .bashrc in your home directory that contains a line something like
PATH = ./subTmp:/usr/local/bin
Just edit it to be whatever you need.
this should do
export PATH=/usr/local/bin

Resources