I wrote a script a while back that is supposed to be run in bash. It includes a hashpling (#!/bin/bash). Some people who are using the script are having problems with it however because they are forcing it to run in sh. They are doing things like:
Code:
sh script.sh
and
Code:
cat script.sh | sh
which ignores the hashpling and runs the script in sh, making the script fail half way through. How do I make my script determine the shell it's being run in and stop running if it's in /bin/sh?
PS: No, it's not
Code:
echo $SHELL
which has nothing to do with the shell you are currently in. No it's not
Code:
echo $0
which can be used in an interactive shell but does not work the same way in a script. No it's not
Code:
ps -p $$
as this will not work inside of a script the same way as it does in an interactive shell either. Those are the 3 methods that people keep describing when searching for the answer on google, and none of those works for what I need.
I am using ubuntu10.04-server 64bit AMD with fluxbox. After I ran Matlab in a shell (without GUI) the shell does not display characters anymore, but will execute any command, I just can't see the characters that I'm typing.. I use aterm and xterm, does anybody know why that is, am I missing a package?
Is there any way I can switch my desktop shell from unity to, say, gnome-shell? I can switch using other console shell I like (bash, csh, fish, etc.). Assume that there is a stable alternative desktop shell, I should be able to choose, too.
(For console shell, we goes to /etc/passwd. But for desktop, I can't find the way to config.)
MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.
I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.
Code: if [ $# -eq 0 ] ; then d=`pwd` for i in * ; do if test -d $d/$i ; then echo "$i:" code....
Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?
Example:
Code:
>>> import subprocess >>> help(subprocess) ... [pages of stuff to read] ...
I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.
I am wondering if I can open a shell or new terminal thing from within the terminal in a unix/linux enviroment. Particularly a commandline only one where there is no GUI. Is this doable? how do I do it?
I've created a simple script based menu. This menu will be accessed by only a certain users via ssh.When user logs in, the menu will automatically run. (configured at user's .bash_profile).How do I force the session to close when user hits Ctrl-C or Ctrl-Break ?In a nutshell, I don't want user to have access to shell.
I have a situation where I am in a non-interactive shell. I have tried from within my non-interative shell to spawn an interactive shell but my output still does not goto me. Isn't there a way I can somehow go into /proc or somwhere and make the output my /dev/tty1? Or some way else to remedy this?The situation arises because I drop from my restricted shell environment (a sort of CLI interface), into the actual Linux shell. I cannot change the code of the CLI environment I am just faced with being in the linux shell environment and its non-interactive. Its very annoying to have to put > /dev/tty1 after every command I type.
Not to mention it seems damn near impossible to get pagers like more and less to work properly when your in a non-interactive shell.
I need to frequently convert jpg/png to eps. Usually I use GIMP and it works fine. I would like to perform the conversion via shell (maybe with a script) without opening any graphical window. I used the command convert of ImageMagick but the quality is poor, I assume that it is because of some parameter to set I do not know. I know the question is trivial and full of posts around but I'm wasting time without finding what I'm really looking for.
I installed Gnome 3 on Natty successfully, despite some minor glitches. It works fine, but recently I found some nice screenshots that looks quite different from which I get, and from others I saw before. You can found it in this link: [URL] Some one knows to what the differences are due?
I have the natty version of lubuntu. i gave it permision to run as an executablei made the xterminalthe default application to open it.the shell script itself is ok because i started it in ubuntu and it worked.the shell script will only open as a text file.
When I try to start alacarte from the shell, I get: Traceback (most recent call last):
[Code]...
The reason I start from the shell is because I noticed that it would crash after starting up in system monitor. This problem started after I tried to remove a program from the list which had already been manually removed. When this program was unchecked, the list went completely blank. I tried to revert the list, but it didn't work. Is there any hopes of repair?
I am looking for a method to run a shell script or open an application through the web browser.For example, open OpenOffice from the browser (without going through the menus).Is it possible?My ultimate goal to pass an argument through the browser to a script. I know it is pretty far fetched for my very limited abilities but I wanna try. For example I want to pass an URL or a text string from the browser to a shell script
I'm new to linux and try to make a ubuntu home server.1.One of my concerns is that i can't figure out how to use bittorrent (or any other torrent download application) from shell. (i have the desktop package installed but i don't wanne get used with that - or should i start the downloads from there but if I close the gdm (gdm stop) will my bittorrent stop as well?)
I ve installed Ubuntu 9.10.I need to work on zsh shell. Am i new to linux. I used chsh -l to find out the list of shells installed in ubuntu. WHen i tried to type zsh and press enter via my default login shell bash,it says sh:zsh not found. Zsh is not installed in ,y system?? And if i have to install zsh shell what is the step?
I just upgraded to beta 10.04, & am trying to get GNOME-shell installed. I have downloaded the tar file for it, but when I do ./configure in a terminal, I get the following error messages: No package 'mutter-plugins' found No package 'gjs-gi-1.0' found No package 'gobject-introspection-1.0' found
Is there a way to prevent a user from being able to login more than once. Not a one-time login, but a single login. What I'm trying to do here is in moving our email system, an email user would login to this account, enter some password information, sync up their email, and have the passwords files removed, then log off. Next user can log in to the same account.
The reason for the single login is to protect the user's passwords.