You are not logged in.
Pages: 1
Hi,
I have been tring add a new folder directory to my varibles path.
This is the path I need set to the variables path -> /home/box/Documents/bash_scripts
Inside the folder bash_scripts has a script I would like to run.
I got the below result typing the follow command -> echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
I got the .profile (file) to edit that instead use a command line.
And it is what I have from .profile:
----------------------------------------------------------------------
# /etc/profile
#Set our umask
umask 022
# Set our default path
PATH="/usr/local/sbin:/usr/local/bin:/usr/bin"
export PATH
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r "$profile" && . "$profile"
done
unset profile
fi
# Source global bash config
if test "$PS1" && test "$BASH" && test -z ${POSIXLY_CORRECT+x} && test -r /etc/bash.bashrc; then
. /etc/bash.bashrc
fi
# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP
# Man is much better than us at figuring this out
unset MANPATH
---------------------------------------------------------------------------------
What file these paths are set ???? ---->> /usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
How can I use this command below:
export PATH=&PATH:<directory>
in the field <directory> need I give insert the hole path to the directory?
For exemple:
I want include a folder with the follow path : /home/box/Documents/bash_scripts
export PATH=&PATH: /home/box/Documents/bash_scripts (is it correct?).
Thanks.
...can you point me a commmand to point a .cpp file to run inside the script.?
Last edited by 47box (2016-07-15 22:27:27)
Offline
Please use code tags for file content and commands,
like so
Bash will source some files in /etc/profile.d for systemwide configuration (you should not touch those or add your own files there unless you know exactly what you are doing).
I don't understand why you are using "&PATH", It should be
export PATH="$PATH:/home/box/Documents/bash_scripts"
if you want to add /home/box/Documents/bash_scripts to the path.
Yes, you need to use the full path.
...can you point me a commmand to point a .cpp file to run inside the script.?
What do you mean? You can't "run" a .cpp file. Do you want a command to compile it? Or do you want a command to run the compiled program?
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Please use code tags for file content and commands,
like so
ok
Bash will source some files in /etc/profile.d for systemwide configuration (you should not touch those or add your own files there unless you know exactly what you are doing).
I don't understand why you are using "&PATH", It should be
export PATH="$PATH:/home/box/Documents/bash_scripts"
if you want to add /home/box/Documents/bash_scripts to the path.
I do not know why I was using it too.
Thanks for the full command.
Need I set the command inside the .profile (file) or just run it using shell?Yes, you need to use the full path.
Ok.47box wrote:...can you point me a commmand to point a .cpp file to run inside the script.?
What do you mean? You can't "run" a .cpp file. Do you want a command to compile it? Or do you want a command to run the compiled program?
My idea is create a cpp file that give me many options to run commands.
Exemple:
List me all pacman commands calling it cpp and I can use a cpp file to make things easy or at least learn more about it
if pressed 1 it whil run for exemple:
pacman -Qs "any_program"
if pressed 2 it wil run ....:
pacman Ss "xxxxxx"
The point I have doubt is:
to start a cpp program I need to call it ....
I think I will need use shell at first moment to run cpp.
If something better to do let me know and I will get material to see.
Thanks brother
Offline
Just learn to use pacman directly, There are too many combinations of commands to handle the way you propose, and you are just hiding how pacman works, which goes against the Arch way. If you are going to use Arch, you should want to learn about how the system works, not hide it.
If you just want to save some typing, look up Bash "aliases". For example, you could use
alias syu='sudo pacman -Syu'
to run system upgrades with "syu".
Besides, using C++ (which is what I assume you mean by "cpp file") just to run other executables makes no sense. Scripting languages are far better for that, especially Bash, which is a full scripting language on its own. For example, the following would accept a single argument and run different commands based on that argument
#!/bin/bash
case "$1" in
1) echo one ;;
2) echo two ;;
3) echo three ;;
*) echo "unrecognized argument: $1"
esac
but again, it's a bad idea to use this for fixed pacman commands.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
I will get some material to learn bash srcipt laguange.
Thanks for the help.
Offline
Pages: 1