I have a command   path/to/forticlientsslvpn_cli --server &lt;host&gt;:&lt;port&gt; --vpnuser testpass\101   When I run the script, linux puts a space between testpass and 101. I want the script to see "testpass\101" as the username  I hope I make sense
121893
I copied a file to my Ubuntu vm with a backslash in the name, and I cannot figure out how to rename the file, e.g. mv .\Dockerfile Dockerfile -- the command line does not like that syntax for the filename but I'm not sure how to escape the .\Dockerfile
440
Sorry my knowledge of Linux bash commands is pretty basic, I've been searching for a while but I'm not 100% sure what I need to search for.  I was wondering if there's a way to grab the current logged in users remote host name in a Linux bash script? I have a script in which I need to log each time a user runs it. I'm obtaining the date like so:  cdat=`/bin/date +%a' '%d' '%h' '%Y', '%H':'%M`;   I now need to add the users remote host (not the username they logged in with). I'm not 100% sure I'm using the right terminology here either, just to clarify; by 'remote host name' I mean the same output that prints on the screen on most servers I've logged into over ssh, for example:  Last login: Mon Jul 22 16:35:09 2013 from win7-i7-stuart.my.domain.com   I'm looking for the win7-i7-stuart.my.domain.com bit.
72600
Recently it seems that shell has changed how it handles spaces in parameters. It used to handle them properly (Or at least as I intended it to), but now it recognises it as a bunch of different parameters and completely misses the escape character.  An example of a small script that used to work very well:  #!/bin/sh  exec /home/evan/.applications/Sublime\ Text\ 2/sublime_text $1   So I would give it some filepath with spaces and it used to open the proper file eg, /home/evan/Document/My\ File\ Path/file.txt would open that file.txt. Now it opens "My", "File", "Path", and some unknown "file.txt" Obviously, that won't be the file.txt that I am looking for.  Any help would be appreciated. Thank you in advance.  OS: Ubuntu 13.04 GNOME edition with latest updates  EDIT: I forgot to mention that the command executes perfect. The parameter does not.
13456
I have a working script, which allows me to do a vpn connection. It looks like this:  openvpn --config VPNBook.com-OpenVPN-Euro1/vpnbook-euro1-tcp443.ovpn   All is good, but I have to input the publicly available vpn and password every time I run this script. (Don't worry, I'm not going to do banking or anything serious over a free VPN, this is more for learning).  This is the username and the password available publicly on their website:  Username: vpnbook  Password: he2qv5h   After firing up, the script prompts me for username and password which now I need to copy and paste.   Tue Aug 15 11:54:51 2017 library versions: OpenSSL 1.0.2l  25 May 2017, LZO 2.08 Enter Auth Username: vpnbook Enter Auth Password:    Is there a way of doing it so the script inputs the values on its own?  I tried echoing it, but it isn't that easy.  Or do I have to edit the command itself, somewhere in the files? If yes, can someone point me in the right direction for doing it?
117982
Every time I log into a VM with root, su into a user account, and try to use screen it throws an error:  Cannot open your terminal '/dev/pts/0' - please check.   A Stack Overflow post said I needed to use script /dev/null to fix it, and it works, but it still doesn't explain why I need to type script /dev/null. I would like to understand what it does and why I need to type it.
118071
It's a small laboratory network that connects to another network via an FTP server.  FTP server is managed by the other network.  This lab network is basically 2 clients and one server with several other IP devices connected.  This lab server has Active Directory installed on it.  We have an account on each network. The names of these acct's are the same for each network, and they have the same password.  Password does have a % sign and a $ sign in it.  Trying to map drive at startup on the lab server to point to the FTP server.  Lab server is logged in with local admin acct.  Command I'm using to map drive: net use j: \x.x.x.x\LabTransfer /user:\username &quot;password&quot;   This command will work when typed in a command prompt; BUT fails to run when ran in a .bat file or .cmd file Error message: &quot;System error 86 has occured. The specified password is not correct. Why would the net use command work at a command prompt and not in the .bat file?
48925
It's hard to search for special characters on google, which is why I'm posting this here.  I recently ran (as root) a mv /tmp/folder/* /* when I meant to run mv /tmp/folder/* ./ Big mistake!  Things broke! A lot of files got mixed up and placed into strange places, none of the normal unix commands worked (ls, dir, cat, etc) and once you logged off, you couldn't ssh back in -- it would give you a prompt, but not accept the old passwords.  Running ls /* shows me that it performs ls on every directory in /. If I tried to draw a parallel, then mv should have simply moved (or copied?) the files to every directory in /. Instead, really weird things happened, and I was just curious what exactly was going on.  More info: The files in /tmp/folder had been transferred from a windows machine, and had been named file (#).txt, where (#) is a number up to two digits, with a space between file and the parenthesis. There were ~40 of these text files.
23266
I just saw this in an init script: echo $&quot;Stopping Apache&quot;  What is that dollar-sign for? My research so far: I found this in the bash manual:  extquote  If set, $'string' and $&quot;string&quot; quoting is performed within ${parameter} expansions enclosed in double quotes.  This option is enabled by default.   ...but I'm not finding any difference between strings with and without the $ prefix: $ echo &quot;I am in $PWD&quot; I am in /var/shared/home/southworth/qed $ echo $&quot;I am in $PWD&quot; I am in /var/shared/home/southworth/qed $ echo $&quot;I am in ${PWD}&quot; I am in /var/shared/home/southworth/qed $ echo &quot;I am in ${PWD}&quot; I am in /var/shared/home/southworth/qed $ echo 'I am in ${PWD}' I am in ${PWD} $ echo $'I am in ${PWD}' I am in ${PWD} $ echo $'I am in $PWD' I am in $PWD
71514
With nmcli, I can modify VPN data like this:  nmcli con modify myvpn vpn.data 'refuse-pap = yes, user = xxx'   So I'm wondering if I can set password this way as well?
74518
I have an application which sends a POST request to the VB forum software and logs someone in (without setting cookies or anything).  Once the user is logged in I create a variable that creates a path on their local machine.  c:\tempfolder\date\username  The problem is that some usernames are throwing "Illegal chars" exception. For example if my username was mas|fenix it would throw an exception..  Path.Combine( _         Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData), _   DateTime.Now.ToString("ddMMyyhhmm") + "-" + form1.username)   I don't want to remove it from the string, but a folder with their username is created through FTP on a server. And this leads to my second question. If I am creating a folder on the server can I leave the "illegal chars" in? I only ask this because the server is Linux based, and I am not sure if Linux accepts it or not.  EDIT: It seems that URL encode is NOT what I want.. Here's what I want to do:  old username = mas|fenix new username = mas%xxfenix   Where %xx is the ASCII value or any other value that would easily identify the character.
82471
I've installed a version of Ubuntu Server and although I'm fairly still fresh with Ubuntu, I'm trying to create a bash file to run a program in the background. More importantly, I'm trying to get a file nameto display correct and create it before I start running the program (I like my debug stuff).  However, here is my bash script:    #!/bin/bash  PATH="/var/log/servers/Game/"  FILENAME="startup"  EXT=".log"  DATE=$(date +%d-%m-%Y)  NEWFILE=${PATH}${FILENAME}_${DATE}${EXT}   I have verified that the file does exist in the PATH directory. However, the issue is with the date command. When I run the script bash -x game.sh this is what is displays.   + PATH=/var/log/servers/Game/  + FILENAME=startup  + EXT=.log  ++ date +%d-%m-%Y  game.sh: line 5: date: command not found  + DATE=  + NEWFILE=/var/log/servers/Game/startup_.log  + echo /var/log/servers/Game/startup_.log   I don't understand why it would say the command doesn't work, when I can go to the main console and run date and get a valid response.  Any help is greatly appreciated!
64038
I have a user that has made no modifications to the $PATH in any dot-files: it is exactly the system default setting. From a login shell:  $ ssh example.com user@example.com:~$ cat /tmp/hello.hs #!/bin/bash  echo "$SHELL" echo "$PATH"  user@example.com:~$ /tmp/hello.hs /bin/bash /usr/local/bin:/usr/bin:/bin   Exactly as specified in /etc/profile. This I find rather unexpected:  $ ssh example.com '/tmp/hello.sh' /bin/bash        /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games   Like I said, there's no modification of $PATH in ~/.bashrc, nor in /etc/bash.bashrc. No ~/.ssh/environment either. The ssh(1) declares that the environment variable PATH is     Set to the default PATH, as specified when compiling ssh.   but  from StackOverflow and this  article suggest that I should be able to influence the $PATH for a given command simply by modifying /etc/profile, one of the shell startup files, etc.   What's going on here?
64931
I have a user, say user1, which has modifications to its .bash_profile, one of them changing the PATH, e.g.: export PATH=/some/place:$PATH. This change works fine if I log on as user1 or do a su - user1.  But if I try to run a command via su as root, e.g.:  su -c test.sh oracle   (test contains echo $PATH)  It doesn't seem to have the modified PATH (or root's PATH, for that matter). I've also tried copying .bash_profile to .profile, to no avail.   Why is this happening?
79074
I logged in for the first time, opened terminal, and typed in ‘hostname’. It returned ‘localhost.localdomain.com’. Then I logged as the root user in terminal using the command, ‘su –‘, provided the password for the root user and used the command ‘hostname etest’ where etest is the hostname I’d like my machine to have. To test if I got my hostname changed correctly, I typed ‘hostname’ again at terminal and it returned etest.  However, when I restart my machine, the hostname reverts back to ‘localhost.localdomain.com’.   Here are the entire series of commands I used in terminal.        [thomasm@localhost ~]$ hostname       localhost.localdomain       [thomasm@localhost ~]$ su -       Password:        [root@localhost ~]# hostname etest       [root@localhost ~]# hostname       etest   I had run into the same problem when I set up RHEL and Ubuntu OS’s with VMPlayer.
57130
How I can use a variable name in file path ?  ssl_certificate /home/ec2-user/.certificados/$server_name.crt; ssl_certificate_key /home/ec2-user/.certificados/$server_name.key;
14819
How can I change prompt name seen at terminal?  my prompt :  &lt;user_name&gt;@&lt;user_name&gt;-MEGA-BOOK-VR320:~$   It is too long. I want to change it to:  gcc :    However, I should see the path when I go from one directory to another.  gcc :~$ cd X_directory gcc :~/X_directory$   How can I do that, permanently?
48283
I am taking the Linux Essentials class and was doing well until I hit the scripting chapter. I simply do not understand these concepts.  Wondering if someone can break the following down into ultra simplistic terms or point me to a better reference to learn it. I'm currently using netacad's curriculum.        From the text book (with minor formatting changes):     There are some special variables in addition to the ones you set. You   can pass arguments to your script:  #!/bin/bash echo "Hello $1"       A dollar sign followed by a number N corresponds to the Nth argument   passed to the script. If you call the example above with ./test.sh the   output will be Hello Linux. The $0 variable contains the name of the   script itself.      After a program runs, be it a binary or a script, it returns an exit   code which is an integer between 0 and 255. You can test this through   the $? variable to see if the previous command completed successfully.     I understand how to assign variables and how they work with the $ but the whole issue with $0 and $1 -- I just don't get it.    Any help would be much appreciated.