Tag Info

Hot answers tagged

5

Use ld -soname: $ mkdir dir1 dir2 $ gcc -shared -fPIC -o dir1/func.so func1.c -Wl,-soname,func.so $ gcc -shared -fPIC -o dir2/func.so func2.c -Wl,-soname,func.so $ gcc test.c dir1/func.so $ ldd a.out linux-vdso.so.1 => (0x00007ffda80d7000) func.so => not found libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f639079e000) ...


5

I suppose TERM is set to linux for the init process (pid 1) by Linux kernel here and there. You can see it in /proc/1/environ (sorry the following output is from Ubuntu 15.04): $ sudo strings /proc/1/environ HOME=/ init=/sbin/init recovery= TERM=linux BOOT_IMAGE=/boot/vmlinuz-3.19.0-25-generic.efi.signed PATH=/sbin:/usr/sbin:/bin:/usr/bin PWD=/ ...


4

In bash, the "export" builtin will export the variable to the shell process's environment. Any processes started from that shell will inherit the process from that shell. If you want the envvar to be persistent, you must set it in some place that the software started will inherit from. For the locale related vars, use /etc/locale.conf (manpage). For other ...


2

Does export move the variable abc from shell to the environment OR does it create a copy in the environment and assign it a new value ? Neither. export simply marks a variable for export. When an external command is executed, the shell creates an environment to pass to it. Only variables marked for export are added to that environment. As man bash ...


2

Use single quotes: $ sudo chroot mychroot /bin/bash -c 'MY_VAR=5; echo ${MY_VAR}'


2

Your example wouldn't do anything if $HOME/bin doesn't exist. Maybe try this instead: # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi PATH=/usr/local/MATLAB/R2015a/bin/:$PATH And, running ./matlab will never work (if matlab is not in the current directory) because you are trying to run ...


2

The main problem is that ./matlab runs the executable called matlab in the current directory. To look for it in $PATH, you need to type just matlab. The PATH variable is only used when there's no slash in the command name. Also, remove the export PATH=… line and instead add PATH=$PATH:/usr/local/MATLAB/R2015a/bin or ...


2

A reboot isn't necessary, but reloading your .profile is. Try running source .profile. Alternatively, you can log off and log on again.


1

Use yaegashi's answer, or escape the $ like $ sudo chroot mychroot /bin/bash -c "MY_VAR=5; echo \${MY_VAR}"


1

Try to type simply matlab and not ./matlab. The ./ means that you are looking for the executable matlab in the current directory without going through the PATH variable.


1

You are right, when exporting or declaring a variable inside a shell, the variable is not added to the shell's environment (in the mean of updating the file - read below). You can view environment variables of the shell (or any other process) it had when it was invoked, by viewing the /proc/PID/environ file, where PID is the PID of the process you want to ...


1

For one user, add it to ~/.cshrc. To apply it to all users add it to /etc/csh.cshrc: setenv PATH /opt/something-special/ setenv VARNAME some_value


1

This gets what you're shooting for mostly working. example: $ at_path $HOME D<tab><tab> Desktop/ Documents/ Downloads/ Dropbox/ $ at_path $HOME Doc<tab> $ at_path $HOME Documents/<tab><tab> Documents/projects/ Documents/scripts/ Documents/utils/ Documents/clients/ $ at_path $HOME Documents/cli<tab> $ ...



Only top voted, non community-wiki answers of a minimum length are eligible