Sponsored Content
Full Discussion: Using color in scripts
Operating Systems Linux Ubuntu Using color in scripts Post 303033786 by Don Cragun on Thursday 11th of April 2019 04:36:33 PM
Old 04-11-2019
Quote:
Originally Posted by drew77
Code:
andy@7_~/bin$ pwd
/home/andy/bin
andy@7_~/bin$ printf '%s\n' "$PATH"
/home/andy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
andy@7_~/bin$ ls -l my-hilite
ls: cannot access 'my-hilite': No such file or directory
andy@7_~/bin$ type env bash
env is /usr/bin/env
bash is /bin/bash

I named my script Hilite.sh if that makes a difference.
It makes a difference.

If someone gives you a script named my_hilite and you do not install it with the name my-hilite, then you need to change everything that references my-hilite to reference whatever named you used when you installed it instead.

And, when you install it you have to make sure that the script will be readable and executable by whatever users want to run that script.

Code:
chmod 755 Hilite.sh

should give you a reasonably readable, executable script. Then you just have to find EVERYTHING that attempts to invoke my-hilite and change every reference to it to be Hilite.sh.

Last edited by Don Cragun; 04-11-2019 at 05:57 PM.. Reason: Fix typo: s/Hiliite[.]sh/Hilite.sh/
 

2 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to change the background color in the init 3 mode(not line color)

Hello, I am using RHEL 6.1 on VMware I am searching for a way to change background color (not line by line color wich one can using tput command) basically changing the color of the whole screen to white instead of the default black and changing font color to black and alos would like to... (2 Replies)
Discussion started by: Dexobox
2 Replies

2. UNIX for Beginners Questions & Answers

Text color in Linux scripts via putty

hi Folks, Can anyone help with changing the color of the words in a linux shell script? I get how to change default background etc in putty, but for some reason the text in the script has different colors for different parts of the cript. Is there a way to have one color in a linux shell... (5 Replies)
Discussion started by: jonnyd
5 Replies
getusershell(3C)					   Standard C Library Functions 					  getusershell(3C)

NAME
getusershell, setusershell, endusershell - get legal user shells SYNOPSIS
#include <unistd.h> char *getusershell(void); void setusershell(void); void endusershell(void); DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If /etc/shells does not exist, the following locations of the standard system shells are used in its place: /bin/bash /bin/csh /bin/jsh /bin/ksh /bin/pfcsh /bin/pfksh /bin/pfsh /bin/sh /bin/tcsh /bin/zsh /sbin/jsh /sbin/pfsh /sbin/sh /usr/bin/bash /usr/bin/csh /usr/bin/jsh /usr/bin/ksh /usr/bin/pfcsh /usr/bin/pfksh /usr/bin/pfsh /usr/bin/sh /usr/bin/tcsh /usr/bin/zsh /usr/xpg4/bin/sh The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells. The setusershell() function rewinds the file or the list. The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells. RETURN VALUES
The getusershell() function returns a null pointer on EOF. BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved. SunOS 5.10 30 Aug 2004 getusershell(3C)
All times are GMT -4. The time now is 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy