Sponsored Content
Operating Systems OS X (Apple) Don't understand the practical difference between command aliases and environmental variables Post 302964058 by scrutinizerix on Saturday 9th of January 2016 01:39:52 PM
Old 01-09-2016
Don't understand the practical difference between command aliases and environmental variables

Hey,
I'm recently learning Unix from the video course by Kevin Scoglund. I'm stuck at the moment where he goes into Environmenat variables. I have some issues with understanding what's the essential difference between EV and command aliases: for instance, by writing the command

Code:
alias ll='ls -lahG'

into .bashrc file we ensure that typing every time the shortcut ll we get the whole bunch of modifications to the original command executed whenever we type it.

ALong with that we have so called "environmental variables" (f.e., export LESS='-N') we could equal to any value ("variable") that theoretically when saved to .bashrc should trigger that command exactly as we predefined it.
According to Mr. Scoglund it should work once we launch another Terminal session by opening a new window ir by executing
Code:
source .bashrc

. However, when trying the former it fails to do so (no command found), so I have to rely on the latter which is pain in the ass typing it in every time. It should be mentioned he worked with Snow Leopard while I'm on Lion, so definitely some changes occurred here.

So:

(1) I can't execute .bashrc file commands unless I execute
Code:
source .bashrc

Is there less labourous method of doing that without
Code:
source .bashrc

in Lion?

(2) what's the point of EV since one could assign an alias to a command and the result is pretty much the same?

If I sound dumb forgive me since I was forced to skip that entire chapter about profile, login and resource files due to corrupted video file containing that part Smilie so I might have missed some points completely hence is my confusion.

Last edited by scrutinizerix; 01-10-2016 at 07:29 AM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

i don't understand the "sort" command

i have been trying to understand this chapter titled "Searching for Files and Text" for a few weeks now. unfortunately, this chapter is one of those things, that no matter how hard you try and how long you try for, you are incapable of understanding (at least in my case) this entire chapter,... (2 Replies)
Discussion started by: xyyz
2 Replies

2. UNIX for Advanced & Expert Users

Environmental Variables - where stored ?

Hi all ! Yesterday I defined an environmental variable PATH, but today when I restarted machine, I could not see that it was stored any place. Is there any file where I could save the settings ? I have quite a few env.variables defined, so I need a smarter way to define. regards D (5 Replies)
Discussion started by: DGoubine
5 Replies

3. Shell Programming and Scripting

don't understand a command "."

Hi all, I have a script with those two lines : test -f $PWD/mysetup.txt . $PWD/mysetup.txt I understand the first one, but could anyone explain me the role of the second one? All the thing I find is the usage : Thx in advance (3 Replies)
Discussion started by: Moumou
3 Replies

4. Shell Programming and Scripting

[bash] command line substitution with environmental variables

Hi, I'm using an array that contains compiler FLAGS that need to be executed either before ./configure or after the main 'make' command. example of array containing compiler flags. ------------------------------------------------- FLAGS="CFLAGS=\"-arch x86_64 -g -Os -pipe... (7 Replies)
Discussion started by: ASGR
7 Replies

5. AIX

Best way to setup my own environmental variables ?

I am writing a few korn scripts to be used by all our operators on several 4.1/4.2 AIX servers. I want to create environmental variables that once set, can be read/modified by my scripts (ex: specific folders, file names, conventions, general values, ...). I thought this would be better then... (4 Replies)
Discussion started by: Browser_ice
4 Replies

6. Homework & Coursework Questions

I don't understand some basics..

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1)find all lines in file ,myf that contain all the words cat dog and mouse in any order and start with the letter... (1 Reply)
Discussion started by: cudders
1 Replies

7. UNIX for Dummies Questions & Answers

Another Simple BASH command I don't understand. Help?

I have a text file called file1 which contains the text: "ls -l" When I enter this command: bash < file1 > file1 file1 gets erased. However if I enter this command: bash < file1 > newfile the output from "ls -l" is stored in newfile. My question is why doesn't file1's text ("ls -l") get... (3 Replies)
Discussion started by: phunkypants
3 Replies

8. UNIX for Dummies Questions & Answers

I don't understand conditions :(

Hi there, I have a very general question. I'm rather new to (bash) shell scripting and I don't understand how conditions work... I've read numerous tutorials but I don't get it. I really don't. Sometime what I do works, sometime it doesn't and that's frustating. So what's the actual difference... (0 Replies)
Discussion started by: hypsis
0 Replies
DROPDB(1)						  PostgreSQL Client Applications						 DROPDB(1)

NAME
dropdb - remove a PostgreSQL database SYNOPSIS
dropdb [ option... ] dbname DESCRIPTION
dropdb destroys an existing PostgreSQL database. The user who executes this command must be a database superuser or the owner of the data- base. dropdb is a wrapper around the SQL command DROP DATABASE [drop_database(7)]. There is no effective difference between dropping databases via this utility and via other methods for accessing the server. OPTIONS
dropdb accepts the following command-line arguments: dbname Specifies the name of the database to be removed. -e --echo Echo the commands that dropdb generates and sends to the server. -i --interactive Issues a verification prompt before doing anything destructive. dropdb also accepts the following command-line arguments for connection parameters: -h host --host host Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. -p port --port port Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. -U username --username username User name to connect as. -w --no-password Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. -W --password Force dropdb to prompt for a password before connecting to a database. This option is never essential, since dropdb will automatically prompt for a password if the server demands password authentication. However, dropdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. ENVIRONMENT
PGHOST PGPORT PGUSER Default connection parameters This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see in the documentation). DIAGNOSTICS
In case of difficulty, see DROP DATABASE [drop_database(7)] and psql(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the libpq front-end library will apply. EXAMPLES
To destroy the database demo on the default database server: $ dropdb demo To destroy the database demo using the server on host eden, port 5000, with verification and a peek at the underlying command: $ dropdb -p 5000 -h eden -i -e demo Database "demo" will be permanently deleted. Are you sure? (y/n) y DROP DATABASE demo; SEE ALSO
createdb(1), DROP DATABASE [drop_database(7)] Application 2010-05-14 DROPDB(1)
All times are GMT -4. The time now is 01:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy