<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error Token 13585 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/error-token-13585/m-p/3962370#M27416</link>
    <description>It would seem that the "grep" command on line 8 has produced two hits instead of one, namely:&lt;BR /&gt;13517&lt;BR /&gt;13585&lt;BR /&gt;&lt;BR /&gt;Let me guess: you have two users so that one username is a substring of the other, right?&lt;BR /&gt;For example, "foo" and "foobar". This (or something similar) caused "grep" to produce a two-line output.&lt;BR /&gt;&lt;BR /&gt;When grepping users from /etc/passwd or /etc/shadow, never do just "grep $user". Instead, you'd better do something like:&lt;BR /&gt;grep "^${user}:" &lt;BR /&gt;to specify that you'll want to match the username exactly: substring matches in the username and matches elsewhere on the line (gecos information!) are not accepted. If you don't do this, you'll get bitten sooner or later.&lt;BR /&gt;&lt;BR /&gt;You can simulate this situation by typing this on the command line (after backslash, press Enter):&lt;BR /&gt;last_change=$(( 13517 \&lt;BR /&gt;13585 ))&lt;BR /&gt;&lt;BR /&gt;This will produce the error message:&lt;BR /&gt;bash: 13517 13585 : syntax error in expression (error token is "13585 ")&lt;BR /&gt;&lt;BR /&gt;which matches what you got from your script.</description>
    <pubDate>Thu, 15 Mar 2007 10:51:01 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2007-03-15T10:51:01Z</dc:date>
    <item>
      <title>Error Token 13585</title>
      <link>https://community.hpe.com/t5/operating-system-linux/error-token-13585/m-p/3962369#M27415</link>
      <description>Hi there --&lt;BR /&gt;&lt;BR /&gt;I have a password notification script running on one of our systems, and for some reason the following error message appears whenever it is run:&lt;BR /&gt;&lt;BR /&gt;/root/password_notify: line 8: 13517&lt;BR /&gt;13585 : syntax error in expression (error token is "13585 ")&lt;BR /&gt;&lt;BR /&gt;The script in question is listed below, and line 8 begins with the text last_change:&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;&lt;BR /&gt;users=`grep -v ":\!\!:" /etc/shadow|grep -v ":\*:" |grep -v root|cut -f1 -d:` expire_time=90 today=$((`perl -le 'print time'` / 86400 ))&lt;BR /&gt;&lt;BR /&gt;for user in $users ; do&lt;BR /&gt;last_change=$(( `grep $user /etc/shadow |cut -f3 -d:` )) &lt;BR /&gt;days_left=$(( $expire_time - $today + $last_change )) if [ $days_left -lt 15 -a $days_left -ge 0 ]; then&lt;BR /&gt;   mail -s "Your password on the Hadron server will expire in $days_left days." $user &amp;lt;&amp;lt; EOF Hello, Your password of account $user, which is used for accessing the e-mail server on host `uname -n`, will expire in $days_left days.&lt;BR /&gt;&lt;BR /&gt;Please update your password. If you have any questions, please contact &lt;SYSADMIN&gt; at extension x-yzab or e-mail him at &lt;EMAIL address=""&gt; for help.&lt;BR /&gt;&lt;BR /&gt;Thanks for your support!&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Can someone tell me what the error message means, and what I need to do to correct it? Thanks.&lt;/EMAIL&gt;&lt;/SYSADMIN&gt;</description>
      <pubDate>Thu, 15 Mar 2007 07:30:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/error-token-13585/m-p/3962369#M27415</guid>
      <dc:creator>Andrew Kaplan</dc:creator>
      <dc:date>2007-03-15T07:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error Token 13585</title>
      <link>https://community.hpe.com/t5/operating-system-linux/error-token-13585/m-p/3962370#M27416</link>
      <description>It would seem that the "grep" command on line 8 has produced two hits instead of one, namely:&lt;BR /&gt;13517&lt;BR /&gt;13585&lt;BR /&gt;&lt;BR /&gt;Let me guess: you have two users so that one username is a substring of the other, right?&lt;BR /&gt;For example, "foo" and "foobar". This (or something similar) caused "grep" to produce a two-line output.&lt;BR /&gt;&lt;BR /&gt;When grepping users from /etc/passwd or /etc/shadow, never do just "grep $user". Instead, you'd better do something like:&lt;BR /&gt;grep "^${user}:" &lt;BR /&gt;to specify that you'll want to match the username exactly: substring matches in the username and matches elsewhere on the line (gecos information!) are not accepted. If you don't do this, you'll get bitten sooner or later.&lt;BR /&gt;&lt;BR /&gt;You can simulate this situation by typing this on the command line (after backslash, press Enter):&lt;BR /&gt;last_change=$(( 13517 \&lt;BR /&gt;13585 ))&lt;BR /&gt;&lt;BR /&gt;This will produce the error message:&lt;BR /&gt;bash: 13517 13585 : syntax error in expression (error token is "13585 ")&lt;BR /&gt;&lt;BR /&gt;which matches what you got from your script.</description>
      <pubDate>Thu, 15 Mar 2007 10:51:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/error-token-13585/m-p/3962370#M27416</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2007-03-15T10:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error Token 13585</title>
      <link>https://community.hpe.com/t5/operating-system-linux/error-token-13585/m-p/3962371#M27417</link>
      <description>Hi there --&lt;BR /&gt;&lt;BR /&gt;I made the change you suggested to the script, and when it was rerun, it did not return an error message. I will keep an eye on it, and if there are any further problems, I'll let you know. Thanks.</description>
      <pubDate>Thu, 15 Mar 2007 12:18:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/error-token-13585/m-p/3962371#M27417</guid>
      <dc:creator>Andrew Kaplan</dc:creator>
      <dc:date>2007-03-15T12:18:47Z</dc:date>
    </item>
  </channel>
</rss>

